mirror of
https://github.com/ansible-collections/google.cloud.git
synced 2025-07-28 07:31:29 -07:00
initial commit of stackdriver logging role for GCP
This commit is contained in:
parent
282f8e3b82
commit
42a304bdda
16 changed files with 282 additions and 0 deletions
6
roles/stackdriver_logging/molecule/default/.ansible-lint
Normal file
6
roles/stackdriver_logging/molecule/default/.ansible-lint
Normal file
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
parseable: true
|
||||
skip_list:
|
||||
- ANSIBLE0010
|
||||
use_default_rules: true
|
||||
verbosity: 1
|
11
roles/stackdriver_logging/molecule/default/.yamllint
Normal file
11
roles/stackdriver_logging/molecule/default/.yamllint
Normal file
|
@ -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
|
22
roles/stackdriver_logging/molecule/default/Dockerfile.j2
Normal file
22
roles/stackdriver_logging/molecule/default/Dockerfile.j2
Normal file
|
@ -0,0 +1,22 @@
|
|||
# Molecule managed
|
||||
|
||||
{% if item.registry is defined %}
|
||||
FROM {{ item.registry.url }}/{{ item.image }}
|
||||
{% else %}
|
||||
FROM {{ item.image }}
|
||||
{% endif %}
|
||||
|
||||
{% if item.env is defined %}
|
||||
{% for var, value in item.env.items() %}
|
||||
{% if value %}
|
||||
ENV {{ var }} {{ value }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get install -y python sudo bash ca-certificates iproute2 && apt-get clean; \
|
||||
elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python*-dnf bash iproute && dnf clean all; \
|
||||
elif [ $(command -v yum) ]; then yum makecache fast && yum install -y python sudo yum-plugin-ovl bash iproute && 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 iproute2 && 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 iproute2 && xbps-remove -O; fi
|
27
roles/stackdriver_logging/molecule/default/molecule.yml
Normal file
27
roles/stackdriver_logging/molecule/default/molecule.yml
Normal file
|
@ -0,0 +1,27 @@
|
|||
---
|
||||
dependency:
|
||||
name: galaxy
|
||||
driver:
|
||||
name: docker
|
||||
lint:
|
||||
name: yamllint
|
||||
options:
|
||||
config-file: molecule/default/.yamllint
|
||||
platforms:
|
||||
- name: instance
|
||||
image: ${MOLECULE_DISTRO}
|
||||
privileged: true
|
||||
volumes:
|
||||
- /sys/fs/cgroup:/sys/fs/cgroup:ro
|
||||
provisioner:
|
||||
name: ansible
|
||||
lint:
|
||||
name: ansible-lint
|
||||
options:
|
||||
c: molecule/default/.ansible-lint
|
||||
scenario:
|
||||
name: default
|
||||
verifier:
|
||||
name: testinfra
|
||||
lint:
|
||||
name: flake8
|
5
roles/stackdriver_logging/molecule/default/playbook.yml
Normal file
5
roles/stackdriver_logging/molecule/default/playbook.yml
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
- name: Converge
|
||||
hosts: all
|
||||
roles:
|
||||
- role: stackdriver_logging
|
|
@ -0,0 +1,15 @@
|
|||
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'
|
Loading…
Add table
Add a link
Reference in a new issue