diff --git a/.travis.yml b/.travis.yml index 3834d31..88116b6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,17 +1,20 @@ --- +os: linux + dist: bionic -language: minimal +language: shell env: - matrix: + jobs: - MOLECULE_SCENARIO_NAME="centos-7" - MOLECULE_SCENARIO_NAME="suse-15" - MOLECULE_SCENARIO_NAME="ubuntu-16.04" - MOLECULE_SCENARIO_NAME="ubuntu-18.04" + - MOLECULE_SCENARIO_NAME="ubuntu-19.10" -matrix: +jobs: allow_failures: - env: MOLECULE_SCENARIO_NAME="centos-7" - env: MOLECULE_SCENARIO_NAME="suse-15" diff --git a/CHANGELOG.md b/CHANGELOG.md index 1534908..d0718af 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,16 @@ # Ansible Role for Snapd -## 4.2.0 - TBC +## 4.3.0 - TBC ### Major Changes - - Migrate molecule tests to Libvirt +## 4.2.0 - 2020-02-13 + +### Major Changes + + - Migrate molecule driver to Libvirt + - Migrate molecule verifier to Ansible + - Support Ubuntu 19.10 ## 4.1.0 - 2020-01-16 diff --git a/README.md b/README.md index 05d09d6..d92de1d 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ Ansible Role for Snapd Installation. This role require Ansible 2.9 or higher. -This role was designed for Ubuntu 16.04/18.04 or RHEL/CentOS 7 or openSUSE Leap 15.1. +This role was designed for Ubuntu 16.04/18.04/19.10 or RHEL/CentOS 7 or openSUSE Leap 15.1. ## Role Variables diff --git a/meta/main.yml b/meta/main.yml index 2096018..d0c83c1 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -26,6 +26,7 @@ galaxy_info: versions: - xenial - bionic + - eoan - name: EL versions: - 7 diff --git a/molecule/centos-7/molecule.yml b/molecule/centos-7/molecule.yml index cc04b4c..d14ede0 100644 --- a/molecule/centos-7/molecule.yml +++ b/molecule/centos-7/molecule.yml @@ -58,6 +58,6 @@ provisioner: playbooks: prepare: prepare.yml verifier: - name: testinfra + name: ansible lint: - name: flake8 + name: ansible-lint diff --git a/molecule/centos-7/playbook.yml b/molecule/centos-7/playbook.yml index 9eb9b6a..affaade 100644 --- a/molecule/centos-7/playbook.yml +++ b/molecule/centos-7/playbook.yml @@ -19,22 +19,3 @@ become: true roles: - role: snapd - -- hosts: all - remote_user: root - become: true - tasks: - - name: start service - service: - name: "{{ item.name }}" - state: "started" - loop: - - { name: "snapd" } - - { name: "snapd.socket" } - changed_when: false - ignore_errors: true - - - name: snap version - command: snap version - register: result - changed_when: result is not succeeded diff --git a/molecule/centos-7/prepare.yml b/molecule/centos-7/prepare.yml index 33b44cc..da84992 100644 --- a/molecule/centos-7/prepare.yml +++ b/molecule/centos-7/prepare.yml @@ -8,21 +8,25 @@ - name: cp -rfT /etc/skel /root raw: | cp -rfT /etc/skel /root + changed_when: false ignore_errors: true - name: setenforce 0 raw: | setenforce 0 + changed_when: false ignore_errors: true - name: systemctl stop firewalld.service raw: | systemctl stop firewalld.service + changed_when: false ignore_errors: true - name: systemctl stop ufw.service raw: | systemctl stop ufw.service + changed_when: false ignore_errors: true - name: redhat-7 | subscription-manager register @@ -31,22 +35,26 @@ --username={{ lookup('env', 'REDHAT_USERNAME') }} \ --password={{ lookup('env', 'REDHAT_PASSWORD') }} \ --autosubscribe + changed_when: false ignore_errors: true - name: debian | apt-get install -y ca-certificates curl gcc iproute2 python3 python3-dev sudo raw: | apt-get update apt-get install -y ca-certificates curl gcc iproute2 python3 python3-dev sudo + changed_when: false ignore_errors: true - name: redhat | yum install -y ca-certificates curl gcc iproute python3 python3-devel sudo raw: | yum makecache fast yum install -y ca-certificates curl gcc iproute python3 python3-devel sudo + changed_when: false ignore_errors: true - name: suse | zypper -n install -y ca-certificates curl gcc iproute2 python3 python3-devel sudo raw: | zypper -n --gpg-auto-import-keys refresh zypper -n install -y ca-certificates curl gcc iproute2 python3 python3-devel sudo + changed_when: false ignore_errors: true diff --git a/molecule/centos-7/tests/test_default.py b/molecule/centos-7/tests/test_default.py deleted file mode 100644 index 9e0e189..0000000 --- a/molecule/centos-7/tests/test_default.py +++ /dev/null @@ -1,15 +0,0 @@ -import os - -import testinfra.utils.ansible_runner - -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE'] -).get_hosts('all') - - -def test_hosts_file(host): - f = host.file('/etc/hosts') - - assert f.exists - assert f.user == 'root' - assert f.group == 'root' diff --git a/molecule/centos-7/verify.yml b/molecule/centos-7/verify.yml new file mode 100644 index 0000000..e995ab3 --- /dev/null +++ b/molecule/centos-7/verify.yml @@ -0,0 +1,24 @@ +--- + +# (c) Wong Hoi Sing Edison +# +# 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. + +- hosts: all + remote_user: root + become: true + tasks: + - name: snap version + command: snap version + register: result + changed_when: result is not succeeded diff --git a/molecule/redhat-7/molecule.yml b/molecule/redhat-7/molecule.yml index 8b98336..52a5d92 100644 --- a/molecule/redhat-7/molecule.yml +++ b/molecule/redhat-7/molecule.yml @@ -58,6 +58,6 @@ provisioner: playbooks: prepare: prepare.yml verifier: - name: testinfra + name: ansible lint: - name: flake8 + name: ansible-lint diff --git a/molecule/redhat-7/playbook.yml b/molecule/redhat-7/playbook.yml index 9eb9b6a..affaade 100644 --- a/molecule/redhat-7/playbook.yml +++ b/molecule/redhat-7/playbook.yml @@ -19,22 +19,3 @@ become: true roles: - role: snapd - -- hosts: all - remote_user: root - become: true - tasks: - - name: start service - service: - name: "{{ item.name }}" - state: "started" - loop: - - { name: "snapd" } - - { name: "snapd.socket" } - changed_when: false - ignore_errors: true - - - name: snap version - command: snap version - register: result - changed_when: result is not succeeded diff --git a/molecule/redhat-7/prepare.yml b/molecule/redhat-7/prepare.yml index 33b44cc..da84992 100644 --- a/molecule/redhat-7/prepare.yml +++ b/molecule/redhat-7/prepare.yml @@ -8,21 +8,25 @@ - name: cp -rfT /etc/skel /root raw: | cp -rfT /etc/skel /root + changed_when: false ignore_errors: true - name: setenforce 0 raw: | setenforce 0 + changed_when: false ignore_errors: true - name: systemctl stop firewalld.service raw: | systemctl stop firewalld.service + changed_when: false ignore_errors: true - name: systemctl stop ufw.service raw: | systemctl stop ufw.service + changed_when: false ignore_errors: true - name: redhat-7 | subscription-manager register @@ -31,22 +35,26 @@ --username={{ lookup('env', 'REDHAT_USERNAME') }} \ --password={{ lookup('env', 'REDHAT_PASSWORD') }} \ --autosubscribe + changed_when: false ignore_errors: true - name: debian | apt-get install -y ca-certificates curl gcc iproute2 python3 python3-dev sudo raw: | apt-get update apt-get install -y ca-certificates curl gcc iproute2 python3 python3-dev sudo + changed_when: false ignore_errors: true - name: redhat | yum install -y ca-certificates curl gcc iproute python3 python3-devel sudo raw: | yum makecache fast yum install -y ca-certificates curl gcc iproute python3 python3-devel sudo + changed_when: false ignore_errors: true - name: suse | zypper -n install -y ca-certificates curl gcc iproute2 python3 python3-devel sudo raw: | zypper -n --gpg-auto-import-keys refresh zypper -n install -y ca-certificates curl gcc iproute2 python3 python3-devel sudo + changed_when: false ignore_errors: true diff --git a/molecule/redhat-7/tests/test_default.py b/molecule/redhat-7/tests/test_default.py deleted file mode 100644 index 9e0e189..0000000 --- a/molecule/redhat-7/tests/test_default.py +++ /dev/null @@ -1,15 +0,0 @@ -import os - -import testinfra.utils.ansible_runner - -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE'] -).get_hosts('all') - - -def test_hosts_file(host): - f = host.file('/etc/hosts') - - assert f.exists - assert f.user == 'root' - assert f.group == 'root' diff --git a/molecule/redhat-7/verify.yml b/molecule/redhat-7/verify.yml new file mode 100644 index 0000000..e995ab3 --- /dev/null +++ b/molecule/redhat-7/verify.yml @@ -0,0 +1,24 @@ +--- + +# (c) Wong Hoi Sing Edison +# +# 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. + +- hosts: all + remote_user: root + become: true + tasks: + - name: snap version + command: snap version + register: result + changed_when: result is not succeeded diff --git a/molecule/suse-15/molecule.yml b/molecule/suse-15/molecule.yml index 0a3c3b7..437b37a 100644 --- a/molecule/suse-15/molecule.yml +++ b/molecule/suse-15/molecule.yml @@ -58,6 +58,6 @@ provisioner: playbooks: prepare: prepare.yml verifier: - name: testinfra + name: ansible lint: - name: flake8 + name: ansible-lint diff --git a/molecule/suse-15/playbook.yml b/molecule/suse-15/playbook.yml index 9eb9b6a..affaade 100644 --- a/molecule/suse-15/playbook.yml +++ b/molecule/suse-15/playbook.yml @@ -19,22 +19,3 @@ become: true roles: - role: snapd - -- hosts: all - remote_user: root - become: true - tasks: - - name: start service - service: - name: "{{ item.name }}" - state: "started" - loop: - - { name: "snapd" } - - { name: "snapd.socket" } - changed_when: false - ignore_errors: true - - - name: snap version - command: snap version - register: result - changed_when: result is not succeeded diff --git a/molecule/suse-15/prepare.yml b/molecule/suse-15/prepare.yml index 33b44cc..da84992 100644 --- a/molecule/suse-15/prepare.yml +++ b/molecule/suse-15/prepare.yml @@ -8,21 +8,25 @@ - name: cp -rfT /etc/skel /root raw: | cp -rfT /etc/skel /root + changed_when: false ignore_errors: true - name: setenforce 0 raw: | setenforce 0 + changed_when: false ignore_errors: true - name: systemctl stop firewalld.service raw: | systemctl stop firewalld.service + changed_when: false ignore_errors: true - name: systemctl stop ufw.service raw: | systemctl stop ufw.service + changed_when: false ignore_errors: true - name: redhat-7 | subscription-manager register @@ -31,22 +35,26 @@ --username={{ lookup('env', 'REDHAT_USERNAME') }} \ --password={{ lookup('env', 'REDHAT_PASSWORD') }} \ --autosubscribe + changed_when: false ignore_errors: true - name: debian | apt-get install -y ca-certificates curl gcc iproute2 python3 python3-dev sudo raw: | apt-get update apt-get install -y ca-certificates curl gcc iproute2 python3 python3-dev sudo + changed_when: false ignore_errors: true - name: redhat | yum install -y ca-certificates curl gcc iproute python3 python3-devel sudo raw: | yum makecache fast yum install -y ca-certificates curl gcc iproute python3 python3-devel sudo + changed_when: false ignore_errors: true - name: suse | zypper -n install -y ca-certificates curl gcc iproute2 python3 python3-devel sudo raw: | zypper -n --gpg-auto-import-keys refresh zypper -n install -y ca-certificates curl gcc iproute2 python3 python3-devel sudo + changed_when: false ignore_errors: true diff --git a/molecule/suse-15/tests/test_default.py b/molecule/suse-15/tests/test_default.py deleted file mode 100644 index 9e0e189..0000000 --- a/molecule/suse-15/tests/test_default.py +++ /dev/null @@ -1,15 +0,0 @@ -import os - -import testinfra.utils.ansible_runner - -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE'] -).get_hosts('all') - - -def test_hosts_file(host): - f = host.file('/etc/hosts') - - assert f.exists - assert f.user == 'root' - assert f.group == 'root' diff --git a/molecule/suse-15/verify.yml b/molecule/suse-15/verify.yml new file mode 100644 index 0000000..e995ab3 --- /dev/null +++ b/molecule/suse-15/verify.yml @@ -0,0 +1,24 @@ +--- + +# (c) Wong Hoi Sing Edison +# +# 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. + +- hosts: all + remote_user: root + become: true + tasks: + - name: snap version + command: snap version + register: result + changed_when: result is not succeeded diff --git a/molecule/ubuntu-16.04/molecule.yml b/molecule/ubuntu-16.04/molecule.yml index 683c5b4..88b5d3f 100644 --- a/molecule/ubuntu-16.04/molecule.yml +++ b/molecule/ubuntu-16.04/molecule.yml @@ -58,6 +58,6 @@ provisioner: playbooks: prepare: prepare.yml verifier: - name: testinfra + name: ansible lint: - name: flake8 + name: ansible-lint diff --git a/molecule/ubuntu-16.04/playbook.yml b/molecule/ubuntu-16.04/playbook.yml index 9eb9b6a..affaade 100644 --- a/molecule/ubuntu-16.04/playbook.yml +++ b/molecule/ubuntu-16.04/playbook.yml @@ -19,22 +19,3 @@ become: true roles: - role: snapd - -- hosts: all - remote_user: root - become: true - tasks: - - name: start service - service: - name: "{{ item.name }}" - state: "started" - loop: - - { name: "snapd" } - - { name: "snapd.socket" } - changed_when: false - ignore_errors: true - - - name: snap version - command: snap version - register: result - changed_when: result is not succeeded diff --git a/molecule/ubuntu-16.04/prepare.yml b/molecule/ubuntu-16.04/prepare.yml index 33b44cc..da84992 100644 --- a/molecule/ubuntu-16.04/prepare.yml +++ b/molecule/ubuntu-16.04/prepare.yml @@ -8,21 +8,25 @@ - name: cp -rfT /etc/skel /root raw: | cp -rfT /etc/skel /root + changed_when: false ignore_errors: true - name: setenforce 0 raw: | setenforce 0 + changed_when: false ignore_errors: true - name: systemctl stop firewalld.service raw: | systemctl stop firewalld.service + changed_when: false ignore_errors: true - name: systemctl stop ufw.service raw: | systemctl stop ufw.service + changed_when: false ignore_errors: true - name: redhat-7 | subscription-manager register @@ -31,22 +35,26 @@ --username={{ lookup('env', 'REDHAT_USERNAME') }} \ --password={{ lookup('env', 'REDHAT_PASSWORD') }} \ --autosubscribe + changed_when: false ignore_errors: true - name: debian | apt-get install -y ca-certificates curl gcc iproute2 python3 python3-dev sudo raw: | apt-get update apt-get install -y ca-certificates curl gcc iproute2 python3 python3-dev sudo + changed_when: false ignore_errors: true - name: redhat | yum install -y ca-certificates curl gcc iproute python3 python3-devel sudo raw: | yum makecache fast yum install -y ca-certificates curl gcc iproute python3 python3-devel sudo + changed_when: false ignore_errors: true - name: suse | zypper -n install -y ca-certificates curl gcc iproute2 python3 python3-devel sudo raw: | zypper -n --gpg-auto-import-keys refresh zypper -n install -y ca-certificates curl gcc iproute2 python3 python3-devel sudo + changed_when: false ignore_errors: true diff --git a/molecule/ubuntu-16.04/tests/test_default.py b/molecule/ubuntu-16.04/tests/test_default.py deleted file mode 100644 index 9e0e189..0000000 --- a/molecule/ubuntu-16.04/tests/test_default.py +++ /dev/null @@ -1,15 +0,0 @@ -import os - -import testinfra.utils.ansible_runner - -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE'] -).get_hosts('all') - - -def test_hosts_file(host): - f = host.file('/etc/hosts') - - assert f.exists - assert f.user == 'root' - assert f.group == 'root' diff --git a/molecule/ubuntu-16.04/verify.yml b/molecule/ubuntu-16.04/verify.yml new file mode 100644 index 0000000..e995ab3 --- /dev/null +++ b/molecule/ubuntu-16.04/verify.yml @@ -0,0 +1,24 @@ +--- + +# (c) Wong Hoi Sing Edison +# +# 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. + +- hosts: all + remote_user: root + become: true + tasks: + - name: snap version + command: snap version + register: result + changed_when: result is not succeeded diff --git a/molecule/ubuntu-18.04/molecule.yml b/molecule/ubuntu-18.04/molecule.yml index f6b0ec0..5b16807 100644 --- a/molecule/ubuntu-18.04/molecule.yml +++ b/molecule/ubuntu-18.04/molecule.yml @@ -58,6 +58,6 @@ provisioner: playbooks: prepare: prepare.yml verifier: - name: testinfra + name: ansible lint: - name: flake8 + name: ansible-lint diff --git a/molecule/ubuntu-18.04/playbook.yml b/molecule/ubuntu-18.04/playbook.yml index 9eb9b6a..affaade 100644 --- a/molecule/ubuntu-18.04/playbook.yml +++ b/molecule/ubuntu-18.04/playbook.yml @@ -19,22 +19,3 @@ become: true roles: - role: snapd - -- hosts: all - remote_user: root - become: true - tasks: - - name: start service - service: - name: "{{ item.name }}" - state: "started" - loop: - - { name: "snapd" } - - { name: "snapd.socket" } - changed_when: false - ignore_errors: true - - - name: snap version - command: snap version - register: result - changed_when: result is not succeeded diff --git a/molecule/ubuntu-18.04/prepare.yml b/molecule/ubuntu-18.04/prepare.yml index 33b44cc..da84992 100644 --- a/molecule/ubuntu-18.04/prepare.yml +++ b/molecule/ubuntu-18.04/prepare.yml @@ -8,21 +8,25 @@ - name: cp -rfT /etc/skel /root raw: | cp -rfT /etc/skel /root + changed_when: false ignore_errors: true - name: setenforce 0 raw: | setenforce 0 + changed_when: false ignore_errors: true - name: systemctl stop firewalld.service raw: | systemctl stop firewalld.service + changed_when: false ignore_errors: true - name: systemctl stop ufw.service raw: | systemctl stop ufw.service + changed_when: false ignore_errors: true - name: redhat-7 | subscription-manager register @@ -31,22 +35,26 @@ --username={{ lookup('env', 'REDHAT_USERNAME') }} \ --password={{ lookup('env', 'REDHAT_PASSWORD') }} \ --autosubscribe + changed_when: false ignore_errors: true - name: debian | apt-get install -y ca-certificates curl gcc iproute2 python3 python3-dev sudo raw: | apt-get update apt-get install -y ca-certificates curl gcc iproute2 python3 python3-dev sudo + changed_when: false ignore_errors: true - name: redhat | yum install -y ca-certificates curl gcc iproute python3 python3-devel sudo raw: | yum makecache fast yum install -y ca-certificates curl gcc iproute python3 python3-devel sudo + changed_when: false ignore_errors: true - name: suse | zypper -n install -y ca-certificates curl gcc iproute2 python3 python3-devel sudo raw: | zypper -n --gpg-auto-import-keys refresh zypper -n install -y ca-certificates curl gcc iproute2 python3 python3-devel sudo + changed_when: false ignore_errors: true diff --git a/molecule/ubuntu-18.04/tests/test_default.py b/molecule/ubuntu-18.04/tests/test_default.py deleted file mode 100644 index 9e0e189..0000000 --- a/molecule/ubuntu-18.04/tests/test_default.py +++ /dev/null @@ -1,15 +0,0 @@ -import os - -import testinfra.utils.ansible_runner - -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE'] -).get_hosts('all') - - -def test_hosts_file(host): - f = host.file('/etc/hosts') - - assert f.exists - assert f.user == 'root' - assert f.group == 'root' diff --git a/molecule/ubuntu-18.04/verify.yml b/molecule/ubuntu-18.04/verify.yml new file mode 100644 index 0000000..e995ab3 --- /dev/null +++ b/molecule/ubuntu-18.04/verify.yml @@ -0,0 +1,24 @@ +--- + +# (c) Wong Hoi Sing Edison +# +# 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. + +- hosts: all + remote_user: root + become: true + tasks: + - name: snap version + command: snap version + register: result + changed_when: result is not succeeded diff --git a/molecule/ubuntu-19.10/group_vars/all/all.yml b/molecule/ubuntu-19.10/group_vars/all/all.yml new file mode 120000 index 0000000..796af02 --- /dev/null +++ b/molecule/ubuntu-19.10/group_vars/all/all.yml @@ -0,0 +1 @@ +../../../../defaults/main.yml \ No newline at end of file diff --git a/molecule/ubuntu-19.10/molecule.yml b/molecule/ubuntu-19.10/molecule.yml new file mode 100644 index 0000000..3f01180 --- /dev/null +++ b/molecule/ubuntu-19.10/molecule.yml @@ -0,0 +1,63 @@ +--- + +# (c) Wong Hoi Sing Edison +# +# 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. + +driver: + name: vagrant + provider: + name: libvirt +platforms: + - name: ${MOLECULE_INSTANCE_NAME}-1 + box: generic/ubuntu1910 + cpu: 2 + memory: 2048 + interfaces: + - auto_config: true + network_name: private_network + type: dhcp + provider_raw_config_args: + - 'nic_model_type = "virtio"' + - 'disk_bus = "virtio"' + - 'volume_cache = "none"' + - 'storage :file, bus: "virtio", cache: "none"' +lint: + name: yamllint +dependency: + name: galaxy + options: + role-file: ansible-role-requirements.yml + roles-path: ${ANSIBLE_ROLES_PATH} + ignore-errors: true +provisioner: + name: ansible + env: + ANSIBLE_ROLES_PATH: ${ANSIBLE_ROLES_PATH} + config_options: + defaults: + forks: 20 + ssh_connection: + pipelining: true + ssh_args: -o ControlMaster=auto -o ControlPersist=600s + lint: + name: ansible-lint + inventory: + links: + group_vars: group_vars + playbooks: + prepare: prepare.yml +verifier: + name: ansible + lint: + name: ansible-lint diff --git a/molecule/ubuntu-19.10/playbook.yml b/molecule/ubuntu-19.10/playbook.yml new file mode 100644 index 0000000..affaade --- /dev/null +++ b/molecule/ubuntu-19.10/playbook.yml @@ -0,0 +1,21 @@ +--- + +# (c) Wong Hoi Sing Edison +# +# 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. + +- hosts: all + remote_user: root + become: true + roles: + - role: snapd diff --git a/molecule/ubuntu-19.10/prepare.yml b/molecule/ubuntu-19.10/prepare.yml new file mode 100644 index 0000000..da84992 --- /dev/null +++ b/molecule/ubuntu-19.10/prepare.yml @@ -0,0 +1,60 @@ +--- + +- hosts: all + remote_user: root + become: true + gather_facts: false + tasks: + - name: cp -rfT /etc/skel /root + raw: | + cp -rfT /etc/skel /root + changed_when: false + ignore_errors: true + + - name: setenforce 0 + raw: | + setenforce 0 + changed_when: false + ignore_errors: true + + - name: systemctl stop firewalld.service + raw: | + systemctl stop firewalld.service + changed_when: false + ignore_errors: true + + - name: systemctl stop ufw.service + raw: | + systemctl stop ufw.service + changed_when: false + ignore_errors: true + + - name: redhat-7 | subscription-manager register + raw: | + subscription-manager register \ + --username={{ lookup('env', 'REDHAT_USERNAME') }} \ + --password={{ lookup('env', 'REDHAT_PASSWORD') }} \ + --autosubscribe + changed_when: false + ignore_errors: true + + - name: debian | apt-get install -y ca-certificates curl gcc iproute2 python3 python3-dev sudo + raw: | + apt-get update + apt-get install -y ca-certificates curl gcc iproute2 python3 python3-dev sudo + changed_when: false + ignore_errors: true + + - name: redhat | yum install -y ca-certificates curl gcc iproute python3 python3-devel sudo + raw: | + yum makecache fast + yum install -y ca-certificates curl gcc iproute python3 python3-devel sudo + changed_when: false + ignore_errors: true + + - name: suse | zypper -n install -y ca-certificates curl gcc iproute2 python3 python3-devel sudo + raw: | + zypper -n --gpg-auto-import-keys refresh + zypper -n install -y ca-certificates curl gcc iproute2 python3 python3-devel sudo + changed_when: false + ignore_errors: true diff --git a/molecule/ubuntu-19.10/verify.yml b/molecule/ubuntu-19.10/verify.yml new file mode 100644 index 0000000..e995ab3 --- /dev/null +++ b/molecule/ubuntu-19.10/verify.yml @@ -0,0 +1,24 @@ +--- + +# (c) Wong Hoi Sing Edison +# +# 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. + +- hosts: all + remote_user: root + become: true + tasks: + - name: snap version + command: snap version + register: result + changed_when: result is not succeeded diff --git a/requirements.txt b/requirements.txt index 4be6040..43e775a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -18,10 +18,8 @@ ansible-runner ansible-runner-http argcomplete docker>=2.0.0 -flake8 molecule netaddr openshift>=0.9.0 python-vagrant -testinfra>=3.0.4 yamllint diff --git a/tasks/main.yml b/tasks/main.yml index d1e5db5..c7c747e 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -48,14 +48,15 @@ ignore_errors: true tags: snapd +- name: flush handlers + meta: flush_handlers + tags: snapd + - name: enable service service: name: "snapd" + state: "started" enabled: true changed_when: false ignore_errors: true tags: snapd - -- name: flush handlers - meta: flush_handlers - tags: snapd diff --git a/vars/ubuntu-19.10.yml b/vars/ubuntu-19.10.yml new file mode 100644 index 0000000..1375014 --- /dev/null +++ b/vars/ubuntu-19.10.yml @@ -0,0 +1,20 @@ +--- + +# (c) Wong Hoi Sing Edison +# +# 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. + +_apt: + - { state: "latest", name: "fuse" } + - { state: "latest", name: "squashfuse" } + - { state: "latest", name: "snapd" }