Skip to content
Snippets Groups Projects
Commit 9e49f92d authored by Ross Elliot's avatar Ross Elliot
Browse files

Modify role to support ESS Linux

[ICSHWI-7320]
parent 58c078a9
No related branches found
No related tags found
1 merge request!4Add ESS Linux support to role
......@@ -12,18 +12,21 @@ provisioner:
defaults:
gather_timeout: 20
inventory:
host_vars:
ics-ans-role-conda-create-env:
group_vars:
conda_create_env:
conda_env_files:
- "{{ playbook_dir }}/tests/python36_env.yml"
- https://gitlab.esss.lu.se/ics-ansible-galaxy/ics-ans-role-conda/raw/master/molecule/default/tests/python27_env.yml
conda_default_env: python36
conda_owner: vagrant
conda_group: vagrant
ics-ans-role-conda-rpm:
conda_rpm:
conda_channels:
- conda-forge
- anaconda-main
ess_linux:
ansible_python_interpreter:
"/usr/bin/python3"
scenario:
name: default
verifier:
......@@ -35,7 +38,38 @@ platforms:
image: centos:7
- name: ics-ans-role-conda-create-env
image: centos:7
groups:
- conda_create_env
- name: ics-ans-role-conda-rpm
image: centos:7
groups:
- conda_rpm
- name: ics-ans-role-conda-debian
image: debian:9
- name: ics-ans-role-conda-ess-linux
image: ess-linux
capabilities:
- SYS_ADMIN
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup
tmpfs:
- /run
- /run/lock
command: /lib/systemd/systemd
privileged: true
groups:
- ess_linux
- name: ics-ans-role-conda-create-env-ess-linux
image: ess-linux
capabilities:
- SYS_ADMIN
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup
tmpfs:
- /run
- /run/lock
command: /lib/systemd/systemd
privileged: true
groups:
- ess_linux
- conda_create_env
......@@ -11,8 +11,15 @@
file:
path: /opt/conda/.condarc
state: touch
- name: Add additional packages for ESS Linux
hosts: ics-ans-role-conda-create-env-ess-linux
tasks:
- name: install python3-terminal
yum:
name: python3-terminal
state: present
- name: Prepare ics-ans-role-conda-create-env
hosts: ics-ans-role-conda-create-env
hosts: ics-ans-role-conda-create-env*
gather_facts: false
tasks:
- name: create vagrant user
......
---
- name: Side Effect
hosts: ics-ans-role-conda-default
hosts:
- ics-ans-role-conda-default
- ics-ans-role-conda-ess-linux
vars:
conda_path: /opt/conda
become: true
......
......@@ -20,7 +20,10 @@ def test_conda_path(host):
def test_condarc_file(host):
condarc = host.file("/opt/conda/.condarc")
if host.ansible.get_variables()["inventory_hostname"] == "ics-ans-role-conda-rpm":
if (
host.ansible.get_variables()["inventory_hostname"]
== "ics-ans-role-conda-rpm"
):
assert (
condarc.content_string.strip()
== """channel_alias: https://artifactory.esss.lu.se/artifactory/api/conda
......@@ -51,6 +54,9 @@ def test_condaz_default_env_file(host):
if (
host.ansible.get_variables()["inventory_hostname"]
== "ics-ans-role-conda-create-env"
) or (
host.ansible.get_variables()["inventory_hostname"]
== "ics-ans-role-conda-create-env-ess-linux"
):
assert (
condaz_default_env.content_string.strip()
......@@ -66,6 +72,9 @@ def test_conda_owner(host, name):
if (
host.ansible.get_variables()["inventory_hostname"]
== "ics-ans-role-conda-create-env"
) or (
host.ansible.get_variables()["inventory_hostname"]
== "ics-ans-role-conda-create-env-ess-linux"
):
user = "vagrant"
group = "vagrant"
......
......@@ -4,7 +4,7 @@ import testinfra.utils.ansible_runner
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ["MOLECULE_INVENTORY_FILE"]
).get_hosts("ics-ans-role-conda-create-env")
).get_hosts("ics-ans-role-conda-create-env*")
def test_conda_env_python36(host):
......
......@@ -6,6 +6,12 @@
- sudo
state: present
- name: install extra required packages (ess-linux)
package:
name:
- tar
state: present
- name: check if conda is installed
command: "{{ conda_path }}/bin/conda --version 2>&1"
check_mode: false
......@@ -59,6 +65,15 @@
become_user: "{{ conda_owner }}"
when: (run_conda_version.rc != 0) or (run_conda_version.stdout != "conda " ~ conda_version)
- name: create /etc/profile.d directory
file:
path: '/etc/profile.d'
mode: 0755
owner: root
group: root
state: directory
when: ansible_os_family == 'Concurrent CPU SDK'
- name: create link to conda.sh profile
file:
src: "{{ conda_path }}/etc/profile.d/conda.sh"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment