diff --git a/.drone.yml b/.drone.yml index 754efc7..a4f66d8 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,12 +1,18 @@ --- -name: Ansible Playbook Lint and Test Execution +name: run_ansible_tests kind: pipeline type: docker +environment: + ANSIBLE_DOCKER_IMAGE : gitea.thezengarden.net/podman/images/ansible-dev:latest + ANSIBLE_INVENTORY : "-i 127.0.0.1, --connection=local" + ANSIBLE_PLAYBOOK : hello.yml + + steps: - - name: "Verify environment" - image: gitea.thezengarden.net/podman/images/ansible-dev:latest + - name: "ansible_environment_verify" + image: "$ANSIBLE_DOCKER_IMAGE" commands: - git log -1 - ansible --version @@ -17,13 +23,8 @@ steps: event: [push] -############################################################################### -############################################################################### -############################################################################### - - - - name: "Ansible-Galaxy: Install from requirements.yml" - image: gitea.thezengarden.net/podman/images/ansible-dev:latest + - name: "ansible_galaxy_requirements" + image: "$ANSIBLE_DOCKER_IMAGE" commands: - ansible-galaxy install -r $DRONE_WORKSPACE/requirements.yml when: @@ -32,8 +33,8 @@ steps: event: [push] - - name: "Syntax check and Ansible Lint" - image: gitea.thezengarden.net/podman/images/ansible-dev:latest + - name: "ansible_lint" + image: "$ANSIBLE_DOCKER_IMAGE" commands: - ansible-lint --offline $DRONE_WORKSPACE when: @@ -42,13 +43,13 @@ steps: event: [push] - - name: "Test playbook execution" - image: gitea.thezengarden.net/podman/images/ansible-dev:latest + - name: "ansible_playbook_execution" + image: "$ANSIBLE_DOCKER_IMAGE" environment: ANSIBLE_INVENTORY: from_secret: ansible_inventory commands: - - ansible-playbook -v -i 127.0.0.1, --connection=local $DRONE_WORKSPACE/hello.yml + - ansible-playbook -v $ANSIBLE_INVENTORY $DRONE_WORKSPACE/$ANSIBLE_PLAYBOOK when: branch: - development diff --git a/hello.yml b/hello.yml index a7bb415..a90c638 100644 --- a/hello.yml +++ b/hello.yml @@ -1,11 +1,8 @@ - name: Hello world - hosts: localhost - connection: local + hosts: all become: false gather_facts: false - bob: - - is great tasks: - name: Say Hello world