Merge "Remove unused hieradata ansible tasks for datafiles"
This commit is contained in:
commit
4e1bab6e17
@ -1,37 +0,0 @@
|
|||||||
# Molecule managed
|
|
||||||
# Copyright 2019 Red Hat, Inc.
|
|
||||||
# All Rights Reserved.
|
|
||||||
#
|
|
||||||
# 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.
|
|
||||||
|
|
||||||
|
|
||||||
{% if item.registry is defined %}
|
|
||||||
FROM {{ item.registry.url }}/{{ item.image }}
|
|
||||||
{% else %}
|
|
||||||
FROM {{ item.image }}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
RUN if [ $(command -v apt-get) ]; then apt-get update && 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 python*-dnf bash {{ item.pkg_extras | default('') }} && dnf clean all; \
|
|
||||||
elif [ $(command -v yum) ]; then yum makecache fast && yum install -y python sudo yum-plugin-ovl python-setuptools bash {{ item.pkg_extras | default('') }} && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \
|
|
||||||
elif [ $(command -v zypper) ]; then zypper refresh && zypper install -y python sudo bash python-xml {{ item.pkg_extras | default('') }} && zypper clean -a; \
|
|
||||||
elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates {{ item.pkg_extras | default('') }}; \
|
|
||||||
elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates {{ item.pkg_extras | default('') }} && xbps-remove -O; fi
|
|
||||||
|
|
||||||
{% for pkg in item.easy_install | default([]) %}
|
|
||||||
# install pip for centos where there is no python-pip rpm in default repos
|
|
||||||
RUN easy_install {{ pkg }}
|
|
||||||
{% endfor %}
|
|
||||||
|
|
||||||
|
|
||||||
CMD ["sh", "-c", "while true; do sleep 10000; done"]
|
|
File diff suppressed because it is too large
Load Diff
@ -1,48 +0,0 @@
|
|||||||
---
|
|
||||||
driver:
|
|
||||||
name: docker
|
|
||||||
|
|
||||||
log: true
|
|
||||||
|
|
||||||
platforms:
|
|
||||||
- name: centos7
|
|
||||||
hostname: centos7
|
|
||||||
image: centos:7
|
|
||||||
dockerfile: Dockerfile
|
|
||||||
pkg_extras: python-setuptools
|
|
||||||
easy_install:
|
|
||||||
- pip
|
|
||||||
environment: &env
|
|
||||||
http_proxy: "{{ lookup('env', 'http_proxy') }}"
|
|
||||||
https_proxy: "{{ lookup('env', 'https_proxy') }}"
|
|
||||||
|
|
||||||
- name: fedora28
|
|
||||||
hostname: fedora28
|
|
||||||
image: fedora:28
|
|
||||||
dockerfile: Dockerfile
|
|
||||||
pkg_extras: python*-setuptools
|
|
||||||
environment:
|
|
||||||
<<: *env
|
|
||||||
|
|
||||||
provisioner:
|
|
||||||
name: ansible
|
|
||||||
log: true
|
|
||||||
env:
|
|
||||||
ANSIBLE_STDOUT_CALLBACK: yaml
|
|
||||||
|
|
||||||
scenario:
|
|
||||||
test_sequence:
|
|
||||||
- destroy
|
|
||||||
- create
|
|
||||||
- prepare
|
|
||||||
- converge
|
|
||||||
- verify
|
|
||||||
- destroy
|
|
||||||
|
|
||||||
lint:
|
|
||||||
enabled: false
|
|
||||||
|
|
||||||
verifier:
|
|
||||||
name: testinfra
|
|
||||||
lint:
|
|
||||||
name: flake8
|
|
@ -1,22 +0,0 @@
|
|||||||
---
|
|
||||||
# Copyright 2019 Red Hat, Inc.
|
|
||||||
# All Rights Reserved.
|
|
||||||
#
|
|
||||||
# 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.
|
|
||||||
|
|
||||||
|
|
||||||
- name: Converge
|
|
||||||
hosts: all
|
|
||||||
roles:
|
|
||||||
- role: tripleo-hieradata
|
|
||||||
hieradata_template: "{{ playbook_dir }}/mock-hieradata.j2.yaml"
|
|
@ -1,21 +0,0 @@
|
|||||||
---
|
|
||||||
# Copyright 2019 Red Hat, Inc.
|
|
||||||
# All Rights Reserved.
|
|
||||||
#
|
|
||||||
# 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.
|
|
||||||
|
|
||||||
|
|
||||||
- name: Prepare
|
|
||||||
hosts: all
|
|
||||||
roles:
|
|
||||||
- role: test_deps
|
|
@ -1,28 +0,0 @@
|
|||||||
# Copyright 2019 Red Hat, Inc.
|
|
||||||
# All Rights Reserved.
|
|
||||||
#
|
|
||||||
# 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.
|
|
||||||
|
|
||||||
|
|
||||||
import os
|
|
||||||
import json
|
|
||||||
|
|
||||||
import testinfra.utils.ansible_runner
|
|
||||||
|
|
||||||
|
|
||||||
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
|
|
||||||
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
|
|
||||||
|
|
||||||
|
|
||||||
def test_hieradata_files(host):
|
|
||||||
assert host.file("/etc/puppet/hieradata/standalone_extraconfig.json").exists
|
|
@ -1,37 +0,0 @@
|
|||||||
# Molecule managed
|
|
||||||
# Copyright 2019 Red Hat, Inc.
|
|
||||||
# All Rights Reserved.
|
|
||||||
#
|
|
||||||
# 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.
|
|
||||||
|
|
||||||
|
|
||||||
{% if item.registry is defined %}
|
|
||||||
FROM {{ item.registry.url }}/{{ item.image }}
|
|
||||||
{% else %}
|
|
||||||
FROM {{ item.image }}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
RUN if [ $(command -v apt-get) ]; then apt-get update && 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 python*-dnf bash {{ item.pkg_extras | default('') }} && dnf clean all; \
|
|
||||||
elif [ $(command -v yum) ]; then yum makecache fast && yum install -y python sudo yum-plugin-ovl python-setuptools bash {{ item.pkg_extras | default('') }} && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \
|
|
||||||
elif [ $(command -v zypper) ]; then zypper refresh && zypper install -y python sudo bash python-xml {{ item.pkg_extras | default('') }} && zypper clean -a; \
|
|
||||||
elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates {{ item.pkg_extras | default('') }}; \
|
|
||||||
elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates {{ item.pkg_extras | default('') }} && xbps-remove -O; fi
|
|
||||||
|
|
||||||
{% for pkg in item.easy_install | default([]) %}
|
|
||||||
# install pip for centos where there is no python-pip rpm in default repos
|
|
||||||
RUN easy_install {{ pkg }}
|
|
||||||
{% endfor %}
|
|
||||||
|
|
||||||
|
|
||||||
CMD ["sh", "-c", "while true; do sleep 10000; done"]
|
|
@ -1,16 +0,0 @@
|
|||||||
---
|
|
||||||
|
|
||||||
fedora28:
|
|
||||||
datafiles:
|
|
||||||
extraconfig:
|
|
||||||
foo: bar1
|
|
||||||
foo2: bar2
|
|
||||||
service_configs:
|
|
||||||
foo: bar3
|
|
||||||
centos7:
|
|
||||||
datafiles:
|
|
||||||
extraconfig:
|
|
||||||
foo: bar1
|
|
||||||
foo2: bar2
|
|
||||||
service_configs:
|
|
||||||
foo: bar3
|
|
@ -1,48 +0,0 @@
|
|||||||
---
|
|
||||||
driver:
|
|
||||||
name: docker
|
|
||||||
|
|
||||||
log: true
|
|
||||||
|
|
||||||
platforms:
|
|
||||||
- name: centos7
|
|
||||||
hostname: centos7
|
|
||||||
image: centos:7
|
|
||||||
dockerfile: Dockerfile
|
|
||||||
pkg_extras: python-setuptools
|
|
||||||
easy_install:
|
|
||||||
- pip
|
|
||||||
environment: &env
|
|
||||||
http_proxy: "{{ lookup('env', 'http_proxy') }}"
|
|
||||||
https_proxy: "{{ lookup('env', 'https_proxy') }}"
|
|
||||||
|
|
||||||
- name: fedora28
|
|
||||||
hostname: fedora28
|
|
||||||
image: fedora:28
|
|
||||||
dockerfile: Dockerfile
|
|
||||||
pkg_extras: python*-setuptools
|
|
||||||
environment:
|
|
||||||
<<: *env
|
|
||||||
|
|
||||||
provisioner:
|
|
||||||
name: ansible
|
|
||||||
log: true
|
|
||||||
env:
|
|
||||||
ANSIBLE_STDOUT_CALLBACK: yaml
|
|
||||||
|
|
||||||
scenario:
|
|
||||||
test_sequence:
|
|
||||||
- destroy
|
|
||||||
- create
|
|
||||||
- prepare
|
|
||||||
- converge
|
|
||||||
- verify
|
|
||||||
- destroy
|
|
||||||
|
|
||||||
lint:
|
|
||||||
enabled: false
|
|
||||||
|
|
||||||
verifier:
|
|
||||||
name: testinfra
|
|
||||||
lint:
|
|
||||||
name: flake8
|
|
@ -1,26 +0,0 @@
|
|||||||
---
|
|
||||||
# Copyright 2019 Red Hat, Inc.
|
|
||||||
# All Rights Reserved.
|
|
||||||
#
|
|
||||||
# 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.
|
|
||||||
|
|
||||||
|
|
||||||
- name: Converge
|
|
||||||
hosts: all
|
|
||||||
roles:
|
|
||||||
- role: tripleo-hieradata
|
|
||||||
hieradata_template: "{{ playbook_dir }}/mock-hieradata.j2.yaml"
|
|
||||||
hieradata_per_host: true
|
|
||||||
hieradata_files:
|
|
||||||
- node
|
|
||||||
- common
|
|
@ -1,21 +0,0 @@
|
|||||||
---
|
|
||||||
# Copyright 2019 Red Hat, Inc.
|
|
||||||
# All Rights Reserved.
|
|
||||||
#
|
|
||||||
# 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.
|
|
||||||
|
|
||||||
|
|
||||||
- name: Prepare
|
|
||||||
hosts: all
|
|
||||||
roles:
|
|
||||||
- role: test_deps
|
|
@ -1,29 +0,0 @@
|
|||||||
# Copyright 2019 Red Hat, Inc.
|
|
||||||
# All Rights Reserved.
|
|
||||||
#
|
|
||||||
# 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.
|
|
||||||
|
|
||||||
|
|
||||||
import os
|
|
||||||
import json
|
|
||||||
|
|
||||||
import testinfra.utils.ansible_runner
|
|
||||||
|
|
||||||
|
|
||||||
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
|
|
||||||
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
|
|
||||||
|
|
||||||
|
|
||||||
def test_hieradata_files(host):
|
|
||||||
assert host.file("/etc/puppet/hieradata/extraconfig.json").exists
|
|
||||||
assert host.file("/etc/puppet/hieradata/service_configs.json").exists
|
|
@ -1,24 +0,0 @@
|
|||||||
---
|
|
||||||
# Copyright 2019 Red Hat, Inc.
|
|
||||||
# All Rights Reserved.
|
|
||||||
#
|
|
||||||
# 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.
|
|
||||||
|
|
||||||
- name: Copy hieradata files
|
|
||||||
copy:
|
|
||||||
dest: /etc/puppet/hieradata/{{ item.key }}.json
|
|
||||||
mode: 0600
|
|
||||||
content: "{{ item.value }}"
|
|
||||||
loop: "{{ hieradata_content['datafiles'] | default({}) | dict2items }}"
|
|
||||||
loop_control:
|
|
||||||
label: "{{ item.key }}"
|
|
@ -35,40 +35,4 @@
|
|||||||
:json:
|
:json:
|
||||||
:datadir: /etc/puppet/hieradata
|
:datadir: /etc/puppet/hieradata
|
||||||
:hierarchy:
|
:hierarchy:
|
||||||
{{ hieradata_files }}
|
{{ hieradata_files | to_nice_yaml if hieradata_files | type_debug == 'list' else hieradata_files }}
|
||||||
|
|
||||||
- name: hieradata block
|
|
||||||
run_once: true
|
|
||||||
block:
|
|
||||||
- name: Create temporary file
|
|
||||||
tempfile:
|
|
||||||
state: file
|
|
||||||
suffix: temp
|
|
||||||
register: tempfile_1
|
|
||||||
changed_when: false
|
|
||||||
notify:
|
|
||||||
- Cleanup temp file
|
|
||||||
|
|
||||||
- name: Template hieradata file
|
|
||||||
template:
|
|
||||||
src: "{{ hieradata_template }}"
|
|
||||||
dest: "{{ tempfile_1.path }}"
|
|
||||||
variable_start_string: "{{ hieradata_variable_start_string }}"
|
|
||||||
variable_end_string: "{{ hieradata_variable_end_string }}"
|
|
||||||
changed_when: false
|
|
||||||
when:
|
|
||||||
- (hieradata_template | string)
|
|
||||||
notify:
|
|
||||||
- Cleanup temp file
|
|
||||||
|
|
||||||
- name: Read temp file
|
|
||||||
slurp:
|
|
||||||
src: "{{ tempfile_1.path }}"
|
|
||||||
register: tempfile_1_slurp
|
|
||||||
changed_when: false
|
|
||||||
notify:
|
|
||||||
- Cleanup temp file
|
|
||||||
|
|
||||||
- include_tasks: "{{ (hieradata_per_host | bool) | ternary('per_host.yml', 'all_hosts.yml') }}"
|
|
||||||
vars:
|
|
||||||
hieradata_content: "{{ tempfile_1_slurp['content'] | b64decode | from_yaml }}"
|
|
||||||
|
@ -1,22 +0,0 @@
|
|||||||
---
|
|
||||||
# Copyright 2019 Red Hat, Inc.
|
|
||||||
# All Rights Reserved.
|
|
||||||
#
|
|
||||||
# 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.
|
|
||||||
|
|
||||||
- name: Copy hieradata for host {{ inventory_hostname }}
|
|
||||||
copy:
|
|
||||||
dest: "/etc/puppet/hieradata/{{ item }}.json"
|
|
||||||
mode: 0600
|
|
||||||
content: "{{ hieradata_content[inventory_hostname]['datafiles'][item] }}"
|
|
||||||
loop: "{{ hieradata_content[inventory_hostname]['datafiles'] | list }}"
|
|
Loading…
x
Reference in New Issue
Block a user