You've already forked ansible-role-common
Add molecule scenario
This commit is contained in:
7
molecule/default/converge.yml
Normal file
7
molecule/default/converge.yml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
- name: Converge
|
||||||
|
hosts: all
|
||||||
|
tasks:
|
||||||
|
- name: "Include ansi-ansible-role-common"
|
||||||
|
include_role:
|
||||||
|
name: "ansi-ansible-role-common"
|
||||||
14
molecule/default/molecule.yml
Normal file
14
molecule/default/molecule.yml
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
---
|
||||||
|
dependency:
|
||||||
|
name: galaxy
|
||||||
|
driver:
|
||||||
|
name: docker
|
||||||
|
platforms:
|
||||||
|
- name: instance
|
||||||
|
image: docker.io/pycontribs/centos:8
|
||||||
|
pre_build_image: true
|
||||||
|
privileged: true
|
||||||
|
provisioner:
|
||||||
|
name: ansible
|
||||||
|
verifier:
|
||||||
|
name: ansible
|
||||||
18
molecule/default/verify.yml
Normal file
18
molecule/default/verify.yml
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
---
|
||||||
|
# This is an example playbook to execute Ansible tests.
|
||||||
|
|
||||||
|
- name: Verify
|
||||||
|
hosts: all
|
||||||
|
gather_facts: false
|
||||||
|
tasks:
|
||||||
|
- name: Capture output of dynamic motd
|
||||||
|
command: /usr/local/bin/dynmotd
|
||||||
|
register: motd
|
||||||
|
changed_when: false
|
||||||
|
|
||||||
|
- debug:
|
||||||
|
msg: "{{ motd.stdout.split('\n') }}"
|
||||||
|
|
||||||
|
- name: Example assertion
|
||||||
|
assert:
|
||||||
|
that: true
|
||||||
@@ -4,19 +4,17 @@
|
|||||||
|
|
||||||
- name: Ensure common packages
|
- name: Ensure common packages
|
||||||
yum:
|
yum:
|
||||||
name: "{{item}}"
|
name: "{{ common_packages }}"
|
||||||
state: present
|
state: present
|
||||||
enablerepo: epel
|
enablerepo: epel
|
||||||
with_items: "{{ common_packages }}"
|
|
||||||
when: ansible_distribution != 'OracleLinux'
|
when: ansible_distribution != 'OracleLinux'
|
||||||
tags: packages
|
tags: packages
|
||||||
|
|
||||||
- name: Ensure common packages
|
- name: Ensure common packages
|
||||||
yum:
|
yum:
|
||||||
name: "{{item}}"
|
name: "{{ common_packages }}"
|
||||||
state: present
|
state: present
|
||||||
enablerepo: ol7_developer_EPEL
|
enablerepo: ol7_developer_EPEL
|
||||||
with_items: "{{ common_packages }}"
|
|
||||||
when: ansible_distribution == 'OracleLinux'
|
when: ansible_distribution == 'OracleLinux'
|
||||||
tags: packages
|
tags: packages
|
||||||
|
|
||||||
@@ -63,11 +61,13 @@
|
|||||||
- name: Ensure Hostname is set
|
- name: Ensure Hostname is set
|
||||||
hostname:
|
hostname:
|
||||||
name: "{{ inventory_hostname }}.{{ domain }}"
|
name: "{{ inventory_hostname }}.{{ domain }}"
|
||||||
|
when:
|
||||||
|
- ansible_virtualization_type != "docker"
|
||||||
|
|
||||||
- name: Change root password
|
- name: Change root password
|
||||||
user:
|
user:
|
||||||
name: root
|
name: root
|
||||||
password: "{{ root_pwd }}"
|
password: "{{ common_root_pwd }}"
|
||||||
changed_when: false
|
changed_when: false
|
||||||
tags: rootpw
|
tags: rootpw
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,13 @@
|
|||||||
---
|
---
|
||||||
|
- name: Ensure resolvers set
|
||||||
|
template:
|
||||||
|
src: etc.resolv.conf.j2
|
||||||
|
dest: /etc/resolv.conf
|
||||||
|
mode: u+rw,a+r
|
||||||
|
tags: dns
|
||||||
|
when:
|
||||||
|
- ansible_virtualization_type != "docker"
|
||||||
|
|
||||||
- name: Ensure DNS and SSH common config
|
- name: Ensure DNS and SSH common config
|
||||||
template:
|
template:
|
||||||
src: "{{ item.src }}"
|
src: "{{ item.src }}"
|
||||||
@@ -10,10 +19,6 @@
|
|||||||
dest: /etc/sysconfig/network,
|
dest: /etc/sysconfig/network,
|
||||||
mode: u+rw,a+r
|
mode: u+rw,a+r
|
||||||
}
|
}
|
||||||
- { src: etc.resolv.conf.j2,
|
|
||||||
dest: /etc/resolv.conf,
|
|
||||||
mode: u+rw,a+r
|
|
||||||
}
|
|
||||||
tags: dns
|
tags: dns
|
||||||
|
|
||||||
- name: Ensure hosts file correct
|
- name: Ensure hosts file correct
|
||||||
@@ -42,6 +47,8 @@
|
|||||||
- {regexp: "^{{ ansible_default_ipv4.address }}.*{{ ansible_nodename.split('.')[0] }}$",
|
- {regexp: "^{{ ansible_default_ipv4.address }}.*{{ ansible_nodename.split('.')[0] }}$",
|
||||||
line: "{{ ansible_default_ipv4.address }} {{ inventory_hostname }}.{{ domain }} {{ inventory_hostname }}"
|
line: "{{ ansible_default_ipv4.address }} {{ inventory_hostname }}.{{ domain }} {{ inventory_hostname }}"
|
||||||
}
|
}
|
||||||
|
when:
|
||||||
|
- ansible_virtualization_type != "docker"
|
||||||
|
|
||||||
- name: Ensure NetworkManager does not fiddle DNS
|
- name: Ensure NetworkManager does not fiddle DNS
|
||||||
ini_file:
|
ini_file:
|
||||||
|
|||||||
Reference in New Issue
Block a user