Skip to content
This repository was archived by the owner on Nov 6, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

* Add docker container property to set the shared memory size ([GH-129](https://github.com/ystia/forge/issues/129))

### BUG FIXES

* Installation of Consul and Ansible fails on recent Centos for GCP images ([GH-131](https://github.com/ystia/forge/issues/131))

## 2.2.0 (April 17, 2020)

### NEW COMPONENTS
Expand Down
55 changes: 26 additions & 29 deletions org/ystia/ansible/linux/ansible/playbooks/create.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,50 +20,47 @@
become: true
become_method: sudo
tasks:
- name: Load a variable file based on the OS type, or a default if not found. Using free-form to specify the file.

- name: Get python version
# This will be deprecated in Ansible 2.9 in favor of python_requirements_info but
# it is not yet available in Ansible 2.7.9
python_requirements_facts:
register: pri
failed_when: "pri == None or pri.python_version == None or pri.python_version == ''"

- name: Load a variable file based on the OS type.
include_vars:
file: "{{ item }}"
with_first_found:
- "vars/{{ ansible_distribution }}.yml"
- "vars/{{ ansible_os_family }}.yml"
- "vars/{{ ansible_os_family }}-py{{pri.python_version | replace('\n', '') | regex_replace('^(\\d+).*', '\\1') }}.yml"
- "vars/{{ ansible_os_family }}-py{{pri.python_version | replace('\n', '') | regex_replace('^(\\d+).*', '\\1') }}.yml"

- name: install prerequirements
package:
name: "{{item}}"
- name: RedHat - install prerequisites
yum:
name: "{{install_packages}}"
state: present
with_items: "{{install_packages}}"

- name: Check if distribution has easy_install or needs a pip3 installation
set_fact:
easy_install_available: "{{ ansible_distribution != 'Ubuntu' or ansible_distribution_major_version is version(18, '<') }}"
update_cache: yes
when: ansible_os_family == 'RedHat'

- name: Ensure pip is installed using easy_install when availabe
easy_install:
name: pip
state: latest
when: easy_install_available

- name: Install python3-pip when easy_install in not available
- name: Debian - install prerequisites
apt:
name:
- python3-pip
name: "{{ install_packages }}"
state: present
update_cache: yes
when: not easy_install_available
when: ansible_os_family == 'Debian'

- name: install using pip
- name: Install latest Pip version
pip:
name:
- "ansible=={{ANSIBLE_VERSION}}"
- "jmespath==0.9.4"
- "netaddr==0.7.19"
when: ANSIBLE_EXTRA_PACKAGE_REPOSITORY == ""
name: "pip"
state: latest
executable: "{{pip_cmd}}"

- name: install using pip package repository "{{ANSIBLE_EXTRA_PACKAGE_REPOSITORY}}"
- name: install Ansible using Pip
pip:
name:
- "ansible=={{ANSIBLE_VERSION}}"
- "jmespath==0.9.4"
- "netaddr==0.7.19"
extra_args: --extra-index-url "{{ANSIBLE_EXTRA_PACKAGE_REPOSITORY}}"
when: ANSIBLE_EXTRA_PACKAGE_REPOSITORY != ""
executable: "{{pip_cmd}}"
extra_args: "{{ '--extra-index-url {}'.format(ANSIBLE_EXTRA_PACKAGE_REPOSITORY) if ANSIBLE_EXTRA_PACKAGE_REPOSITORY != ''}}"
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,6 @@ install_packages:
- make
- python2
- python2-dev
- virtualenv
- python-pip

pip_cmd: "pip"
24 changes: 24 additions & 0 deletions org/ystia/ansible/linux/ansible/playbooks/vars/Debian-py3.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#
# Copyright 2018 Bull S.A.S. Atos Technologies - Bull, Rue Jean Jaures, B.P.68, 78340, Les Clayes-sous-Bois, France.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

install_packages:
- gcc
- make
- python3
- python3-dev
- python3-pip

pip_cmd: "pip3"
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,6 @@ install_packages:
- make
- python2
- python2-devel
- python-virtualenv
- python-pip

pip_cmd: "pip"
24 changes: 24 additions & 0 deletions org/ystia/ansible/linux/ansible/playbooks/vars/RedHat-py3.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#
# Copyright 2018 Bull S.A.S. Atos Technologies - Bull, Rue Jean Jaures, B.P.68, 78340, Les Clayes-sous-Bois, France.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

install_packages:
- gcc
- make
- python3
- python3-devel
- python3-pip

pip_cmd: "pip3"
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
register: apt_res
retries: 3
until: apt_res is success
when: ansible_distribution == 'Ubuntu'
when: ansible_os_family == 'Debian'

- name: Backup original resolve.conf
copy:
Expand All @@ -60,11 +60,30 @@
dnsmasq_conf_log: "DAEMON"
when: INSTALL_DNSMASQ == "true"

- name: Get python version
# This will be deprecated in Ansible 2.9 in favor of python_requirements_info but
# it is not yet available in Ansible 2.7.9
python_requirements_facts:
register: pri
failed_when: "pri == None or pri.python_version == None or pri.python_version == ''"

- name: Set python version for pip
set_fact:
python_pip_pkg: "python3-pip"
pip_cmd: "pip3"

- name: Set python 2 version for pip
set_fact:
python_pip_pkg: "python-pip"
pip_cmd: "pip"
when: pri.python_version is version('3', '<')

- name: RedHat - install prerequisites
yum:
name:
- zip
- unzip
- "{{ python_pip_pkg }}"
state: present
update_cache: yes
when: ansible_os_family == 'RedHat'
Expand All @@ -74,10 +93,27 @@
name:
- zip
- unzip
- "{{ python_pip_pkg }}"
state: present
update_cache: yes
when: ansible_os_family == 'Debian'

- name: Install latest Pip version
pip:
name: "pip"
state: latest
executable: "{{pip_cmd}}"

- name: Copy python requirements
copy:
src: requirements.txt
dest: "{{ INSTALL_DIR }}"

- name: Install python requirements
pip:
requirements: "{{ INSTALL_DIR }}/requirements.txt"
executable: "{{pip_cmd}}"

- name: create Consul group
group: name=consul

Expand Down Expand Up @@ -124,7 +160,7 @@
mode: "u=rx,g=rx,o=rx"

- name: Install consul systemd unit
template:
template:
src: consul.service.j2
dest: "/etc/systemd/system/consul.service"
mode: "u=rw,g=rw,o=r"
Expand All @@ -137,34 +173,7 @@
state: stopped

- name: Install consul maintenance script
template:
template:
src: consul_maintenance.sh.j2
dest: "{{INSTALL_DIR}}/consul_maintenance.sh"
mode: "u=rwx,g=rx,o=rx"

- name: Check if distribution has easy_install or needs a pip3 installation
set_fact:
easy_install_available: "{{ ansible_distribution != 'Ubuntu' or ansible_distribution_major_version is version(18, '<') }}"

- name: Ensure pip is installed using easy_install when availabe
easy_install:
name: pip
state: latest
when: easy_install_available

- name: Install python3-pip when easy_install in not available
apt:
name:
- python3-pip
state: present
update_cache: yes
when: not easy_install_available

- name: Install requirements
copy:
src: requirements.txt
dest: "{{ INSTALL_DIR }}"

- name: Install python requirements
pip:
requirements: "{{ INSTALL_DIR }}/requirements.txt"