Skip to content

Commit

Permalink
Merge pull request #1128 from grycap/devel
Browse files Browse the repository at this point in the history
Devel
  • Loading branch information
micafer authored Mar 1, 2021
2 parents 9f1ea24 + 217aae2 commit fec159d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 44 deletions.
2 changes: 1 addition & 1 deletion contextualization/basic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
ignore_errors: yes

- name: Bootstrap with python RedHat/CentOS
raw: sudo yum install -y python3 || { sudo yum install -y epel-release https://repo.ius.io/ius-release-el6.rpm && sudo yum install -y python36 && ln -s /usr/bin/python3.6 /usr/bin/python3; }
raw: sudo yum install -y python3
ignore_errors: yes
register: python_install
changed_when: python_install.stdout_lines|length > 1
Expand Down
63 changes: 20 additions & 43 deletions contextualization/conf-ansible.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
ignore_errors: yes

- name: Bootstrap with python RedHat/CentOS
raw: sudo yum install -y python3 || { sudo yum install -y epel-release https://repo.ius.io/ius-release-el6.rpm && sudo yum install -y python36 && ln -s /usr/bin/python3.6 /usr/bin/python3; }
raw: sudo yum install -y python3
ignore_errors: yes
register: python_install
changed_when: python_install.stdout_lines|length > 1
Expand Down Expand Up @@ -96,7 +96,7 @@
command: apt install -y --no-install-recommends gcc python3-apt python3.5-dev libffi-dev libssl-dev python3-pip wget python3-setuptools sshpass openssh-client unzip

- name: Ubuntu 14 install pip3.5
command: python3.5 /usr/lib/python3/dist-packages/easy_install.py "pip>=9.0.3" creates=/usr/local/bin/pip3.5
command: python3.5 /usr/lib/python3/dist-packages/easy_install.py "pip>=18.0,<21.0" creates=/usr/local/bin/pip3.5

- name: Remove old pip3 in Ubuntu 14
file: path=/usr/bin/pip3 state=absent
Expand All @@ -113,15 +113,7 @@

- name: Yum install requisites RH 7/8 or Fedora
command: yum install -y python3-pip python3-setuptools sshpass openssh-clients
when: (ansible_os_family == "RedHat" and ansible_distribution_major_version|int > 6)

- name: Yum install requisites RH 6
command: yum install -y python36-pip python36-setuptools sshpass openssh-clients gcc libffi-devel openssl-devel python36-devel
when: ansible_os_family == "RedHat" and ansible_distribution_major_version|int <= 6

- name: Link pip3 in RH 6
command: ln -s /usr/bin/pip3.6 /usr/bin/pip3 creates=/usr/bin/pip3
when: ansible_os_family == "RedHat" and ansible_distribution_major_version|int <= 6
when: ansible_os_family == "RedHat"

- name: Zypper install requirements Suse
zypper: name=python3-pip,python3-setuptools,gcc,python3-devel,wget,libffi-devel,openssl-devel,python3-cryptography,make state=present
Expand Down Expand Up @@ -152,19 +144,31 @@

######################################### Use pip to enable to set the version #############################################

# Version over 21 raises error in older S.O. as ubuntu 16
- name: Upgrade pip
# Version over 21 does not work with python 3.5 or older
- name: Upgrade pip in py3.5
pip:
name: pip>18.0,<21.0
executable: pip3
when: ansible_python_version is version('3.6', '<')

- name: Upgrade pip in py3.6 +
pip:
name: pip>18.0
executable: pip3
when: ansible_python_version is version('3.6', '>=')

- name: Upgrade setuptools with Pip
pip: name=setuptools state=latest executable=pip3
when: ansible_os_family != "RedHat" or ansible_distribution_major_version|int > 6

- name: Install cryptography
pip:
name: cryptography<3.3
executable: pip3

- name: Install pyOpenSSL
pip: name=pyOpenSSL state=latest executable=pip3
when: ansible_os_family != "RedHat" or ansible_distribution_major_version|int > 6
pip:
name: pyOpenSSL>20.0
executable: pip3

- name: Ubuntu 14 extra pip packages needed to avoid https issues
pip: name=urllib3,ndg-httpsclient,pyasn1 executable=pip3
Expand All @@ -174,19 +178,6 @@
pip: name=cryptography version=2.9.2 executable=pip3
when: ansible_distribution == "Ubuntu" and ansible_distribution_major_version|int <= 14

- name: Install pkgs with Pip in RH6
pip: name="{{ item.name }}" version="{{ item.version }}" executable=pip3
when: ansible_os_family == "RedHat" and ansible_distribution_major_version|int <= 6
with_items:
- { name: 'setuptools', version: '28.8.1' }
- { name: 'pyyaml', version: '3.13' }
- { name: 'idna', version: '2.7' }
- { name: 'argparse', version: '1.4.0' }
- { name: 'paramiko', version: '2.2.4' }
- { name: 'xmltodict', version: '0.11.0' }
- { name: 'cryptography', version: '2.1.0' }
- { name: 'pyOpenSSL', version: '17.0.0' }

- name: Install pyyaml
pip: name=pyyaml executable=pip3

Expand All @@ -203,10 +194,6 @@
- name: Install jmespath with Pip
pip: name=jmespath executable=pip3

- name: Install cffi with Pip in RH6
pip: name=cffi executable=pip3
when: ansible_os_family == "RedHat" and ansible_distribution_major_version|int <= 6

- name: Install scp with Pip
pip: name=scp executable=pip3

Expand Down Expand Up @@ -240,16 +227,6 @@

- name: Set transport to ssh in ansible.cfg
ini_file: dest=/etc/ansible/ansible.cfg section=defaults option=transport value=ssh
when: ansible_os_family == "Debian" or (ansible_os_family == "RedHat" and ansible_distribution_major_version|int >= 6) or (ansible_os_family == "Suse" and ansible_distribution_major_version|int >= 10)

- name: Set transport to smart in ansible.cfg
ini_file: dest=/etc/ansible/ansible.cfg section=defaults option=transport value=smart
when: (ansible_os_family == "RedHat" and ansible_distribution_major_version|int < 6) or (ansible_os_family == "Suse" and ansible_distribution_major_version|int < 10)

- name: Change ssh_args to set ControlPersist to 15 min in ansible.cfg
ini_file: dest=/etc/ansible/ansible.cfg section=ssh_connection option=ssh_args value="-o ControlMaster=auto -o ControlPersist=900s -o UserKnownHostsFile=/dev/null"
when: ansible_os_family == "Debian" or (ansible_os_family == "RedHat" and ansible_distribution_major_version|int >= 7) or (ansible_os_family == "Suse" and ansible_distribution_major_version|int >= 12)

- name: Change ssh_args to remove ControlPersist in REL 6 and older in ansible.cfg
ini_file: dest=/etc/ansible/ansible.cfg section=ssh_connection option=ssh_args value="-o UserKnownHostsFile=/dev/null"
when: (ansible_os_family == "RedHat" and ansible_distribution_major_version|int < 7) or (ansible_os_family == "Suse" and ansible_distribution_major_version|int < 12)

0 comments on commit fec159d

Please sign in to comment.