From 3b01de4ca67fca3680612b2925c707151dc6d7b3 Mon Sep 17 00:00:00 2001 From: Joelsy Porven Rubier Date: Sat, 17 Oct 2020 10:11:19 -0400 Subject: [PATCH 1/3] Update test to Molecule v3 --- Pipfile | 4 ++-- molecule/default/{playbook.yml => converge.yml} | 15 ++------------- molecule/default/molecule.yml | 16 +++++++++------- molecule/default/prepare.yml | 12 ++++++++++++ 4 files changed, 25 insertions(+), 22 deletions(-) rename molecule/default/{playbook.yml => converge.yml} (58%) create mode 100644 molecule/default/prepare.yml diff --git a/Pipfile b/Pipfile index f48e0fe..fcb4d84 100644 --- a/Pipfile +++ b/Pipfile @@ -7,9 +7,9 @@ name = "pypi" pre_commit = "*" [packages] -molecule = "*" -docker-py = "*" +molecule = {extras = ["docker"],version = "*"} ansible-lint = "*" +yamllint = "*" [requires] python_version = "2.7" diff --git a/molecule/default/playbook.yml b/molecule/default/converge.yml similarity index 58% rename from molecule/default/playbook.yml rename to molecule/default/converge.yml index 5fb9c4f..b25ccbb 100644 --- a/molecule/default/playbook.yml +++ b/molecule/default/converge.yml @@ -1,24 +1,13 @@ --- -- hosts: all - tasks: - - debug: - msg: "System {{ inventory_hostname }} has OS {{ ansible_distribution}}-{{ ansible_distribution_major_version }}" - -- hosts: all - tasks: - - name: create a group of all hosts by operating system - group_by: - key: "{{ ansible_distribution}}-{{ ansible_distribution_major_version }}" - -- hosts: CentOS-6 +- hosts: CentOS_6 tasks: - name: install initscripts package: name: initscripts state: present -- hosts: CentOS-7 +- hosts: CentOS_7 tasks: - name: remove requiretty from /etc/sudoers lineinfile: diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml index 6eeea3e..ddf5112 100644 --- a/molecule/default/molecule.yml +++ b/molecule/default/molecule.yml @@ -26,12 +26,12 @@ platforms: image: milcom/centos7-systemd:latest privileged: True -ansible: - playbook: playbook.yml +# ansible: +# playbook: playbook.yml -lint: - name: yamllint - enabled: False +# lint: +# name: yamllint +# enabled: False provisioner: name: ansible @@ -75,8 +75,10 @@ provisioner: SHUTDOWN_WAIT: 2 wildfly_temp_dir: /opt/wildfly/standalone/tmp - lint: - name: ansible-lint + lint: | + set -e + yamllint . + ansible-lint scenario: name: default diff --git a/molecule/default/prepare.yml b/molecule/default/prepare.yml new file mode 100644 index 0000000..b555373 --- /dev/null +++ b/molecule/default/prepare.yml @@ -0,0 +1,12 @@ +--- + +- hosts: all + tasks: + - debug: + msg: "System {{ inventory_hostname }} has OS {{ ansible_distribution}}-{{ ansible_distribution_major_version }}" + +- hosts: all + tasks: + - name: create a group of all hosts by operating system + group_by: + key: "{{ ansible_distribution}}_{{ ansible_distribution_major_version }}" \ No newline at end of file From 8d9ca77f5a9b67218abc3bde3e4a153d987a5ced Mon Sep 17 00:00:00 2001 From: Joelsy Porven Rubier Date: Sat, 17 Oct 2020 10:26:14 -0400 Subject: [PATCH 2/3] Remove CentOS6 test and include firewalld for CentOS7 image --- molecule/default/Dockerfile.j2 | 2 +- molecule/default/converge.yml | 12 ++++++------ molecule/default/molecule.yml | 12 ++++++------ 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/molecule/default/Dockerfile.j2 b/molecule/default/Dockerfile.j2 index 19692c2..6e244c4 100644 --- a/molecule/default/Dockerfile.j2 +++ b/molecule/default/Dockerfile.j2 @@ -8,7 +8,7 @@ FROM {{ item.image }} RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get upgrade -y && apt-get install -y python sudo bash ca-certificates && apt-get clean; \ elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python2-dnf bash && dnf clean all; \ - elif [ $(command -v yum) ]; then yum makecache fast && yum update -y && yum install -y python sudo yum-plugin-ovl bash && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \ + elif [ $(command -v yum) ]; then yum makecache fast && yum update -y && yum install -y python firewalld sudo yum-plugin-ovl bash && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \ elif [ $(command -v zypper) ]; then zypper refresh && zypper update -y && zypper install -y python sudo bash python-xml && zypper clean -a; \ elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; \ elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates && xbps-remove -O; fi diff --git a/molecule/default/converge.yml b/molecule/default/converge.yml index b25ccbb..e194728 100644 --- a/molecule/default/converge.yml +++ b/molecule/default/converge.yml @@ -1,11 +1,11 @@ --- -- hosts: CentOS_6 - tasks: - - name: install initscripts - package: - name: initscripts - state: present +# - hosts: CentOS_6 +# tasks: +# - name: install initscripts +# package: +# name: initscripts +# state: present - hosts: CentOS_7 tasks: diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml index ddf5112..188a009 100644 --- a/molecule/default/molecule.yml +++ b/molecule/default/molecule.yml @@ -5,14 +5,14 @@ driver: name: docker platforms: - - name: wildfly-centos6-8.2.1 - image: centos:6.8 + # - name: wildfly-centos6-8.2.1 + # image: centos:6.8 - - name: wildfly-centos6-9.0.1 - image: centos:6.8 + # - name: wildfly-centos6-9.0.1 + # image: centos:6.8 - - name: wildfly-centos6-10.1.0 - image: centos:6.8 + # - name: wildfly-centos6-10.1.0 + # image: centos:6.8 - name: wildfly-centos7-8.2.1 image: milcom/centos7-systemd:latest From e43d6b1981006b7bce42941a1c07d2d967d2201f Mon Sep 17 00:00:00 2001 From: Joelsy Porven Rubier Date: Sat, 17 Oct 2020 17:43:08 -0400 Subject: [PATCH 3/3] Update to Test With CentOS8 and WildFly 20.0.1 --- molecule/default/Dockerfile.j2 | 11 +++++++++-- molecule/default/converge.yml | 8 +------- molecule/default/molecule.yml | 26 +++++++++++--------------- 3 files changed, 21 insertions(+), 24 deletions(-) diff --git a/molecule/default/Dockerfile.j2 b/molecule/default/Dockerfile.j2 index 6e244c4..74c703e 100644 --- a/molecule/default/Dockerfile.j2 +++ b/molecule/default/Dockerfile.j2 @@ -5,9 +5,16 @@ FROM {{ item.registry.url }}/{{ item.image }} {% else %} FROM {{ item.image }} {% endif %} - +ENV ANSIBLE_USER=ansible SUDO_GROUP=wheel DEPLOY_GROUP=deployer RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get upgrade -y && apt-get install -y python sudo bash ca-certificates && apt-get clean; \ - elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python2-dnf bash && dnf clean all; \ + elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python3 sudo python3-devel python3-dnf bash && dnf clean all \ + && set -xe \ + && groupadd -r ${ANSIBLE_USER} \ + && groupadd -r ${DEPLOY_GROUP} \ + && useradd -m -g ${ANSIBLE_USER} ${ANSIBLE_USER} \ + && usermod -aG ${SUDO_GROUP} ${ANSIBLE_USER} \ + && usermod -aG ${DEPLOY_GROUP} ${ANSIBLE_USER} \ + && sed -i "/^%${SUDO_GROUP}/s/ALL\$/NOPASSWD:ALL/g" /etc/sudoers; \ elif [ $(command -v yum) ]; then yum makecache fast && yum update -y && yum install -y python firewalld sudo yum-plugin-ovl bash && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \ elif [ $(command -v zypper) ]; then zypper refresh && zypper update -y && zypper install -y python sudo bash python-xml && zypper clean -a; \ elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; \ diff --git a/molecule/default/converge.yml b/molecule/default/converge.yml index e194728..a1c5374 100644 --- a/molecule/default/converge.yml +++ b/molecule/default/converge.yml @@ -1,12 +1,5 @@ --- -# - hosts: CentOS_6 -# tasks: -# - name: install initscripts -# package: -# name: initscripts -# state: present - - hosts: CentOS_7 tasks: - name: remove requiretty from /etc/sudoers @@ -16,6 +9,7 @@ state: absent - hosts: all + become: yes any_errors_fatal: true pre_tasks: - debug: diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml index 188a009..3e766e6 100644 --- a/molecule/default/molecule.yml +++ b/molecule/default/molecule.yml @@ -5,15 +5,6 @@ driver: name: docker platforms: - # - name: wildfly-centos6-8.2.1 - # image: centos:6.8 - - # - name: wildfly-centos6-9.0.1 - # image: centos:6.8 - - # - name: wildfly-centos6-10.1.0 - # image: centos:6.8 - - name: wildfly-centos7-8.2.1 image: milcom/centos7-systemd:latest privileged: True @@ -26,12 +17,14 @@ platforms: image: milcom/centos7-systemd:latest privileged: True -# ansible: -# playbook: playbook.yml - -# lint: -# name: yamllint -# enabled: False + - name: wildfly-centos8-20.0.1 + image: centos:8 + command: /sbin/init + tmpfs: + - /run + - /tmp + volumes: + - /sys/fs/cgroup:/sys/fs/cgroup:ro provisioner: name: ansible @@ -59,6 +52,9 @@ provisioner: wildfly_version: 9.0.1.Final wildfly-centos7-10.1.0: wildfly_version: 10.1.0.Final + wildfly-centos8-20.0.1: + ansible_user: ansible + wildfly_version: 20.0.1.Final group_vars: all: wildfly_remove_download_file: False