From aebaa0d348c973ab535c6d0cd3031c729c1e1d07 Mon Sep 17 00:00:00 2001 From: Chris Hammer Date: Sat, 16 Dec 2023 01:19:54 -0500 Subject: [PATCH] initial drone build test --- .drone.env | 3 +++ .drone.yml | 26 ++++++++++++++++++++++++++ ansible.cfg | 2 ++ roles/testing/README.md | 4 ++++ roles/testing/meta/main.yml | 29 +++++++++++++++++++++++++++++ roles/testing/tasks/main.yml | 7 +++++++ tests/unit-test.yml | 14 ++++++++++++++ 7 files changed, 85 insertions(+) create mode 100644 .drone.env create mode 100644 .drone.yml create mode 100644 ansible.cfg create mode 100644 roles/testing/README.md create mode 100644 roles/testing/meta/main.yml create mode 100644 roles/testing/tasks/main.yml create mode 100644 tests/unit-test.yml diff --git a/.drone.env b/.drone.env new file mode 100644 index 0000000..5116ab0 --- /dev/null +++ b/.drone.env @@ -0,0 +1,3 @@ +export ANSIBLE_LINT_EXCLUSION="--exclude .gitea" +export ANSIBLE_INVENTORY="-i 127.0.0.1, --connection=local" +export ANSIBLE_PLAYBOOK="baseos.yml" diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..cbdd57f --- /dev/null +++ b/.drone.yml @@ -0,0 +1,26 @@ +--- +kind: pipeline +type: docker +name: CentOS_9-Ansible-Pipeline + +trigger: + branch: + exclude: + - main + event: [push] + +steps: + - name: ansible_environment_verify + image: gitea.thezengarden.net/podman/ansible-dev/centos9:release + commands: + - . ./.drone.env + - env + - git log -1 + - ansible --version + - ansible-lint --version + + - name: ansible_lint + image: gitea.thezengarden.net/podman/ansible-dev/centos9:release + commands: + - . ./.drone.env + - ansible-lint --offline $ANSIBLE_LINT_EXCLUSION diff --git a/ansible.cfg b/ansible.cfg new file mode 100644 index 0000000..fadf537 --- /dev/null +++ b/ansible.cfg @@ -0,0 +1,2 @@ +[defaults] +roles_path = roles diff --git a/roles/testing/README.md b/roles/testing/README.md new file mode 100644 index 0000000..8352313 --- /dev/null +++ b/roles/testing/README.md @@ -0,0 +1,4 @@ +Role Name +========= + +A simple role to say hello to the world. diff --git a/roles/testing/meta/main.yml b/roles/testing/meta/main.yml new file mode 100644 index 0000000..12ab092 --- /dev/null +++ b/roles/testing/meta/main.yml @@ -0,0 +1,29 @@ +galaxy_info: + author: Chris Hammer + description: Simple default role to say hello world. + + license: GPL-2.0-or-later + + min_ansible_version: "2.14" + + platforms: + - name: Fedora + versions: + - all + + - name: EL + versions: + - "8" + - "9" + + galaxy_tags: [] + # List tags for your role here, one per line. A tag is a keyword that describes + # and categorizes the role. Users find roles by searching for tags. Be sure to + # remove the '[]' above, if you add tags to this list. + # + # NOTE: A tag is limited to a single word comprised of alphanumeric characters. + # Maximum 20 tags per role. + +dependencies: [] + # List your role dependencies here, one per line. Be sure to remove the '[]' above, + # if you add dependencies to this list. diff --git a/roles/testing/tasks/main.yml b/roles/testing/tasks/main.yml new file mode 100644 index 0000000..3b82f34 --- /dev/null +++ b/roles/testing/tasks/main.yml @@ -0,0 +1,7 @@ +--- +- name: Hello World. + ansible.builtin.debug: + msg: Hello world. + + +... diff --git a/tests/unit-test.yml b/tests/unit-test.yml new file mode 100644 index 0000000..b4ac657 --- /dev/null +++ b/tests/unit-test.yml @@ -0,0 +1,14 @@ +--- +- name: Test the role provided in extra_vars + hosts: all + become: false + gather_facts: true + + + tasks: + - name: Include role to test + ansible.builtin.include_role: + name: "{{ __test_role | default('testing') }}" + + +...