summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuli Silvius <s.silvius@partner.samsung.com>2019-04-17 08:18:55 +0000
committerGerrit Code Review <gerrit@onap.org>2019-04-17 08:18:55 +0000
commit45fa0030abb4c013722f68c1ef23d53ba1d1620e (patch)
treeebb9d64279e6e740f4a9baf6fab6cb6ab23b1a53
parent1266d180911300c4236a6e1411b1f1782884dafb (diff)
parentf7bcc11eecf16a3565286ea3ae95bbd679fa6135 (diff)
Merge "Molecule tests for chrony role"
-rw-r--r--ansible/roles/chrony/.yamllint11
-rw-r--r--ansible/roles/chrony/defaults/main.yml8
-rw-r--r--ansible/roles/chrony/molecule/default/molecule.yml38
-rw-r--r--ansible/roles/chrony/molecule/default/playbook.yml10
-rw-r--r--ansible/roles/chrony/molecule/default/prepare.yml6
-rw-r--r--ansible/roles/chrony/molecule/ubuntu/molecule.yml39
-rw-r--r--ansible/test/roles/prepare-chrony/tasks/main.yml6
-rw-r--r--ansible/test/roles/prepare-chrony/vars/main.yml4
8 files changed, 118 insertions, 4 deletions
diff --git a/ansible/roles/chrony/.yamllint b/ansible/roles/chrony/.yamllint
new file mode 100644
index 00000000..ad0be760
--- /dev/null
+++ b/ansible/roles/chrony/.yamllint
@@ -0,0 +1,11 @@
+extends: default
+
+rules:
+ braces:
+ max-spaces-inside: 1
+ level: error
+ brackets:
+ max-spaces-inside: 1
+ level: error
+ line-length: disable
+ truthy: disable
diff --git a/ansible/roles/chrony/defaults/main.yml b/ansible/roles/chrony/defaults/main.yml
index af433dac..2dee84ef 100644
--- a/ansible/roles/chrony/defaults/main.yml
+++ b/ansible/roles/chrony/defaults/main.yml
@@ -1,11 +1,11 @@
---
timesync: {}
chrony:
- servers: "{{ timesync.servers | default([hostvars[groups.infrastructure[0]].cluster_ip]) }}" # chronyd's NTP servers
- slewclock: "{{ timesync.slewclock | default(false) }}" # chronyd's makestep property
- timezone: "{{ timesync.timezone | default('Universal') }}" # Timezone name according to tz database
+ servers: "{{ timesync.servers | default([hostvars[groups.infrastructure[0]].cluster_ip]) }}" # chronyd's NTP servers
+ slewclock: "{{ timesync.slewclock | default(false) }}" # chronyd's makestep property
+ timezone: "{{ timesync.timezone | default('Universal') }}" # Timezone name according to tz database
makestep: '1 -1'
- maxjitter: 10 # Max allowed jitter if using infra as time source as it may by unstable due to pretending stratum 1 time source
+ maxjitter: 10 # Max allowed jitter if using infra as time source as it may by unstable due to pretending stratum 1 time source
initstepslew: 30
conf:
RedHat:
diff --git a/ansible/roles/chrony/molecule/default/molecule.yml b/ansible/roles/chrony/molecule/default/molecule.yml
new file mode 100644
index 00000000..a5b48674
--- /dev/null
+++ b/ansible/roles/chrony/molecule/default/molecule.yml
@@ -0,0 +1,38 @@
+---
+dependency:
+ name: galaxy
+driver:
+ name: docker
+lint:
+ name: yamllint
+platforms:
+ - name: infra_host
+ image: molecule-${PREBUILD_PLATFORM_DISTRO:-centos}:${PREBUILD_DISTRO_VERSION:-centos7.6}
+ pre_build_image: True
+ privileged: true
+ volume_mounts:
+ - "/sys/fs/cgroup:/sys/fs/cgroup:ro"
+ override_command: False
+ groups:
+ - infrastructure
+ - name: node0
+ image: molecule-${PREBUILD_PLATFORM_DISTRO:-centos}:${PREBUILD_DISTRO_VERSION:-centos7.6}
+ pre_build_image: True
+ privileged: true
+ volume_mounts:
+ - "/sys/fs/cgroup:/sys/fs/cgroup:ro"
+ override_command: False
+ groups:
+ - kubernetes
+provisioner:
+ name: ansible
+ lint:
+ name: ansible-lint
+ env:
+ ANSIBLE_ROLES_PATH: ../../../../test/roles
+verifier:
+ name: testinfra
+ lint:
+ name: flake8
+ options:
+ v: 1
diff --git a/ansible/roles/chrony/molecule/default/playbook.yml b/ansible/roles/chrony/molecule/default/playbook.yml
new file mode 100644
index 00000000..7dccfc35
--- /dev/null
+++ b/ansible/roles/chrony/molecule/default/playbook.yml
@@ -0,0 +1,10 @@
+---
+- name: Converge infrastructure hosts
+ hosts: infrastructure
+ roles:
+ - chrony
+
+- name: Converge kubernetes hosts
+ hosts: kubernetes
+ roles:
+ - chrony
diff --git a/ansible/roles/chrony/molecule/default/prepare.yml b/ansible/roles/chrony/molecule/default/prepare.yml
new file mode 100644
index 00000000..73582dd3
--- /dev/null
+++ b/ansible/roles/chrony/molecule/default/prepare.yml
@@ -0,0 +1,6 @@
+---
+- name: Setup all hosts for playing chrony role
+ hosts: all
+
+ roles:
+ - prepare-chrony
diff --git a/ansible/roles/chrony/molecule/ubuntu/molecule.yml b/ansible/roles/chrony/molecule/ubuntu/molecule.yml
new file mode 100644
index 00000000..dd2b9655
--- /dev/null
+++ b/ansible/roles/chrony/molecule/ubuntu/molecule.yml
@@ -0,0 +1,39 @@
+---
+dependency:
+ name: galaxy
+driver:
+ name: docker
+lint:
+ name: yamllint
+platforms:
+ - name: infra_host-ubuntu
+ image: molecule-${PREBUILD_PLATFORM_DISTRO:-ubuntu}:${PREBUILD_DISTRO_VERSION:-18.04}
+ pre_build_image: True
+ privileged: true
+ volume_mounts:
+ - "/sys/fs/cgroup:/sys/fs/cgroup:ro"
+ override_command: False
+ groups:
+ - infrastructure
+ - name: node0-ubuntu
+ image: molecule-${PREBUILD_PLATFORM_DISTRO:-ubuntu}:${PREBUILD_DISTRO_VERSION:-18.04}
+ pre_build_image: True
+ privileged: true
+ volume_mounts:
+ - "/sys/fs/cgroup:/sys/fs/cgroup:ro"
+ override_command: False
+ groups:
+ - kubernetes
+provisioner:
+ name: ansible
+ lint:
+ name: ansible-lint
+ env:
+ ANSIBLE_ROLES_PATH: ../../../../test/roles
+ playbooks:
+ prepare: ../default/prepare.yml
+ converge: ../default/playbook.yml
+verifier:
+ name: testinfra
+ lint:
+ name: flake8
diff --git a/ansible/test/roles/prepare-chrony/tasks/main.yml b/ansible/test/roles/prepare-chrony/tasks/main.yml
new file mode 100644
index 00000000..3632ea97
--- /dev/null
+++ b/ansible/test/roles/prepare-chrony/tasks/main.yml
@@ -0,0 +1,6 @@
+---
+- name: Install required packages
+ package:
+ name: "{{ item }}"
+ state: present
+ loop: "{{ packages }}"
diff --git a/ansible/test/roles/prepare-chrony/vars/main.yml b/ansible/test/roles/prepare-chrony/vars/main.yml
new file mode 100644
index 00000000..5dcc78d9
--- /dev/null
+++ b/ansible/test/roles/prepare-chrony/vars/main.yml
@@ -0,0 +1,4 @@
+---
+packages:
+ - chrony
+ - tzdata