From b36f712cedcce7647ce363c427d870807e9d5f1e Mon Sep 17 00:00:00 2001 From: Pablo Estigarribia Date: Sun, 19 Jun 2022 19:53:26 -0300 Subject: [PATCH 1/4] updates for molecule v4 --- molecule/centos-8/converge.yml | 9 ++++--- molecule/default/converge.yml | 9 ++++--- molecule/default/molecule.yml | 15 ----------- molecule/local-stable/converge.yml | 9 ++++--- molecule/local/converge.yml | 9 ++++--- molecule/local/molecule.yml | 15 ----------- molecule/stable-ubuntu-1804/converge.yml | 12 --------- molecule/stable-ubuntu-1804/molecule.yml | 34 ------------------------ molecule/stable-ubuntu-1804/verify.yml | 9 ------- molecule/ubuntu-2004/converge.yml | 7 ++--- 10 files changed, 24 insertions(+), 104 deletions(-) delete mode 100644 molecule/stable-ubuntu-1804/converge.yml delete mode 100644 molecule/stable-ubuntu-1804/molecule.yml delete mode 100644 molecule/stable-ubuntu-1804/verify.yml diff --git a/molecule/centos-8/converge.yml b/molecule/centos-8/converge.yml index 2081e90..f1846a6 100644 --- a/molecule/centos-8/converge.yml +++ b/molecule/centos-8/converge.yml @@ -5,8 +5,9 @@ burpui_standalone: True burpui_pip_burpui_dev: 'git+https://git.ziirish.me/ziirish/burp-ui.git@master#egg=burp-ui' burpui_use_dev: True - roles: - # - role: coffeeitworks.burp2_server - - role: ansible_burpui_server + tasks: + - name: Include ansible_burpui_server + include_role: + name: ansible_burpui_server tags: - - burpui-server + - burpui-server \ No newline at end of file diff --git a/molecule/default/converge.yml b/molecule/default/converge.yml index 2075c8f..f1846a6 100644 --- a/molecule/default/converge.yml +++ b/molecule/default/converge.yml @@ -5,8 +5,9 @@ burpui_standalone: True burpui_pip_burpui_dev: 'git+https://git.ziirish.me/ziirish/burp-ui.git@master#egg=burp-ui' burpui_use_dev: True - roles: - - role: coffeeitworks.burp2_server - - role: ansible_burpui_server + tasks: + - name: Include ansible_burpui_server + include_role: + name: ansible_burpui_server tags: - - burpui-server + - burpui-server \ No newline at end of file diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml index 87328c2..2e4d691 100644 --- a/molecule/default/molecule.yml +++ b/molecule/default/molecule.yml @@ -24,21 +24,6 @@ platforms: groups: - use_pip_package - - name: ansible_burpui_server-04 - image: "geerlingguy/docker-centos8-ansible" - command: /sbin/init - privileged: True - pre_build_image: true - capabilities: - - SYS_ADMIN - tmpfs: - - /run - - /tmp - volumes: - - "/sys/fs/cgroup:/sys/fs/cgroup:ro" - groups: - - use_pip_package - provisioner: name: ansible config_options: diff --git a/molecule/local-stable/converge.yml b/molecule/local-stable/converge.yml index ec44dd8..ee8ba1a 100644 --- a/molecule/local-stable/converge.yml +++ b/molecule/local-stable/converge.yml @@ -4,8 +4,9 @@ vars: burpui_standalone: True burpui_use_dev: False - roles: - # - role: coffeeitworks.burp2_server - - role: ansible_burpui_server + tasks: + - name: Include ansible_burpui_server + include_role: + name: ansible_burpui_server tags: - - burpui-server + - burpui-server \ No newline at end of file diff --git a/molecule/local/converge.yml b/molecule/local/converge.yml index 2081e90..f1846a6 100644 --- a/molecule/local/converge.yml +++ b/molecule/local/converge.yml @@ -5,8 +5,9 @@ burpui_standalone: True burpui_pip_burpui_dev: 'git+https://git.ziirish.me/ziirish/burp-ui.git@master#egg=burp-ui' burpui_use_dev: True - roles: - # - role: coffeeitworks.burp2_server - - role: ansible_burpui_server + tasks: + - name: Include ansible_burpui_server + include_role: + name: ansible_burpui_server tags: - - burpui-server + - burpui-server \ No newline at end of file diff --git a/molecule/local/molecule.yml b/molecule/local/molecule.yml index b5aa669..35de51d 100644 --- a/molecule/local/molecule.yml +++ b/molecule/local/molecule.yml @@ -24,21 +24,6 @@ platforms: groups: - group1 - - name: ansible_burpui_server-04 - image: "geerlingguy/docker-centos8-ansible" - command: /usr/sbin/init - #privileged: True - pre_build_image: true - capabilities: - - SYS_ADMIN - tmpfs: - - /run - - /tmp - volumes: - - "/sys/fs/cgroup:/sys/fs/cgroup:ro" - groups: - - use_pip_package - provisioner: name: ansible config_options: diff --git a/molecule/stable-ubuntu-1804/converge.yml b/molecule/stable-ubuntu-1804/converge.yml deleted file mode 100644 index 21aa8e2..0000000 --- a/molecule/stable-ubuntu-1804/converge.yml +++ /dev/null @@ -1,12 +0,0 @@ ---- -- name: Converge - hosts: all - vars: - burpui_standalone: True - # burpui_pip_burpui_dev: 'git+https://git.ziirish.me/ziirish/burp-ui.git@master#egg=burp-ui' - burpui_use_dev: False - roles: - #- role: coffeeitworks.burp2_server - - role: ansible_burpui_server - tags: - - burpui-server diff --git a/molecule/stable-ubuntu-1804/molecule.yml b/molecule/stable-ubuntu-1804/molecule.yml deleted file mode 100644 index 979c6c3..0000000 --- a/molecule/stable-ubuntu-1804/molecule.yml +++ /dev/null @@ -1,34 +0,0 @@ ---- -dependency: - name: galaxy - options: - ignore-certs: True - ignore-errors: True - role-file: dev_requirements.yml # this file is at the root of the git project same place as molecule is executed -driver: - name: docker -platforms: - - - name: ansible_burpui_server-03 - image: "geerlingguy/docker-ubuntu1804-ansible" - privileged: True - command: /sbin/init - pre_build_image: true - capabilities: - - SYS_ADMIN - tmpfs: - - /run - - /tmp - volumes: - - "/sys/fs/cgroup:/sys/fs/cgroup:ro" - groups: - - use_pip_package - -provisioner: - name: ansible - config_options: - defaults: - callback_whitelist: profile_tasks - ssh_connection: - pipelining: true - ssh_args: -o ControlMaster=auto -o ControlPersist=60s diff --git a/molecule/stable-ubuntu-1804/verify.yml b/molecule/stable-ubuntu-1804/verify.yml deleted file mode 100644 index a82dd6f..0000000 --- a/molecule/stable-ubuntu-1804/verify.yml +++ /dev/null @@ -1,9 +0,0 @@ ---- -# This is an example playbook to execute Ansible tests. - -- name: Verify - hosts: all - tasks: - - name: Example assertion - assert: - that: true diff --git a/molecule/ubuntu-2004/converge.yml b/molecule/ubuntu-2004/converge.yml index 2081e90..8533fdb 100644 --- a/molecule/ubuntu-2004/converge.yml +++ b/molecule/ubuntu-2004/converge.yml @@ -5,8 +5,9 @@ burpui_standalone: True burpui_pip_burpui_dev: 'git+https://git.ziirish.me/ziirish/burp-ui.git@master#egg=burp-ui' burpui_use_dev: True - roles: - # - role: coffeeitworks.burp2_server - - role: ansible_burpui_server + tasks: + - name: Include ansible_burpui_server + include_role: + name: ansible_burpui_server tags: - burpui-server From a92f01bd1ef2e74abd500229ab431a69604ee9d7 Mon Sep 17 00:00:00 2001 From: Pablo Estigarribia Date: Sun, 19 Jun 2022 20:04:47 -0300 Subject: [PATCH 2/4] fixes for master branch --- .github/workflows/molecule-test.yml | 51 ++++++++++++++++------------- 1 file changed, 29 insertions(+), 22 deletions(-) diff --git a/.github/workflows/molecule-test.yml b/.github/workflows/molecule-test.yml index 2f2a9fe..35b14fc 100644 --- a/.github/workflows/molecule-test.yml +++ b/.github/workflows/molecule-test.yml @@ -1,3 +1,5 @@ +# https://thedatabaseme.de/2022/01/17/automated-testing-your-ansible-role-with-molecule-and-github-actions/ + name: Molecule pipeline test on: @@ -19,41 +21,46 @@ jobs: scenario: - centos-8 - ubuntu-2004 - - stable-ubuntu-1804 steps: - name: Checkout uses: actions/checkout@v2 with: path: "${{ github.repository }}" - - - name: Molecule converge - uses: gofrolist/molecule-action@v2 + + - name: Set up Python + uses: actions/setup-python@v2 with: - molecule_options: --debug --base-config molecule/_shared/base.yml - molecule_command: converge - # Always specify scenario and don't use default for better different use cases - molecule_args: --scenario-name ${{ matrix.scenario }} + python-version: '3.x' + + - name: Install dependencies. + run: | + python3 -m pip install --upgrade pip + python3 -m pip install yamllint ansible-lint ansible "molecule[lint,docker]" + + - name: Install Galaxy dependencies. + run: ansible-galaxy collection install community.docker + + - name: check molecule version + run: molecule --version + + - name: Run molecule converge + run: "molecule converge --scenario-name ${{ matrix.scenario }}" env: PY_COLORS: '1' ANSIBLE_FORCE_COLOR: '1' - - name: Molecule syntax - uses: gofrolist/molecule-action@v2 - with: - molecule_options: --debug --base-config molecule/_shared/base.yml - molecule_command: syntax - # Always specify scenario and don't use default for better different use cases - molecule_args: --scenario-name ${{ matrix.scenario }} + working-directory: "${{ github.repository }}" + + - name: Run molecule syntax + run: "molecule syntax --scenario-name ${{ matrix.scenario }}" env: PY_COLORS: '1' ANSIBLE_FORCE_COLOR: '1' - - name: Molecule idempotence - uses: gofrolist/molecule-action@v2 - with: - molecule_options: --debug --base-config molecule/_shared/base.yml - molecule_command: idempotence - # Always specify scenario and don't use default for better different use cases - molecule_args: --scenario-name ${{ matrix.scenario }} + working-directory: "${{ github.repository }}" + + - name: Run molecule idempotence + run: "molecule idempotence --scenario-name ${{ matrix.scenario }}" env: PY_COLORS: '1' ANSIBLE_FORCE_COLOR: '1' + working-directory: "${{ github.repository }}" From af2137f4cdb48f6eff782fb569fe9c798095feee Mon Sep 17 00:00:00 2001 From: Pablo Estigarribia Date: Sun, 19 Jun 2022 20:09:34 -0300 Subject: [PATCH 3/4] meta file fixes --- .github/workflows/galaxy-notify.yml | 51 ++++++++++++++++------------- meta/main.yml | 1 + 2 files changed, 30 insertions(+), 22 deletions(-) diff --git a/.github/workflows/galaxy-notify.yml b/.github/workflows/galaxy-notify.yml index 9500246..ddece50 100644 --- a/.github/workflows/galaxy-notify.yml +++ b/.github/workflows/galaxy-notify.yml @@ -16,7 +16,7 @@ jobs: matrix: # Better to use one scenario per OS for faster performance and easier debugging scenario: - # - centos-8 + - centos-8 - ubuntu-2004 steps: @@ -24,37 +24,44 @@ jobs: uses: actions/checkout@v2 with: path: "${{ github.repository }}" - - - name: Molecule converge - uses: gofrolist/molecule-action@v2 + + - name: Set up Python + uses: actions/setup-python@v2 with: - molecule_options: --debug --base-config molecule/_shared/base.yml - molecule_command: converge - # Always specify scenario and don't use default for better different use cases - molecule_args: --scenario-name ${{ matrix.scenario }} + python-version: '3.x' + + - name: Install dependencies. + run: | + python3 -m pip install --upgrade pip + python3 -m pip install yamllint ansible-lint ansible "molecule[lint,docker]" + + - name: Install Galaxy dependencies. + run: ansible-galaxy collection install community.docker + + - name: check molecule version + run: molecule --version + + - name: Run molecule converge + run: "molecule converge --scenario-name ${{ matrix.scenario }}" env: PY_COLORS: '1' ANSIBLE_FORCE_COLOR: '1' - - name: Molecule syntax - uses: gofrolist/molecule-action@v2 - with: - molecule_options: --debug --base-config molecule/_shared/base.yml - molecule_command: syntax - # Always specify scenario and don't use default for better different use cases - molecule_args: --scenario-name ${{ matrix.scenario }} + working-directory: "${{ github.repository }}" + + - name: Run molecule syntax + run: "molecule syntax --scenario-name ${{ matrix.scenario }}" env: PY_COLORS: '1' ANSIBLE_FORCE_COLOR: '1' - - name: Molecule idempotence - uses: gofrolist/molecule-action@v2 - with: - molecule_options: --debug --base-config molecule/_shared/base.yml - molecule_command: idempotence - # Always specify scenario and don't use default for better different use cases - molecule_args: --scenario-name ${{ matrix.scenario }} + working-directory: "${{ github.repository }}" + + - name: Run molecule idempotence + run: "molecule idempotence --scenario-name ${{ matrix.scenario }}" env: PY_COLORS: '1' ANSIBLE_FORCE_COLOR: '1' + working-directory: "${{ github.repository }}" + # https://github.com/marketplace/actions/publish-ansible-role-to-galaxy # Don't forget to add the secret galaxy_api_key in your repository diff --git a/meta/main.yml b/meta/main.yml index d9f2d3c..a878927 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -2,6 +2,7 @@ galaxy_info: author: "coffeeitworks" company: coffeeITWorks + role_name: ansible_burpui_server description: ansible role to deploy and maintain burpui with all its options # If the issue tracker for your role is not on github, uncomment the From f082878ebf1b035ff30dfd2acc8e0016c2b43074 Mon Sep 17 00:00:00 2001 From: Pablo Estigarribia Date: Sun, 19 Jun 2022 20:21:25 -0300 Subject: [PATCH 4/4] update changelog --- CHANGELOG | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index ada9673..1c6286c 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +2.1.0: +* Fixes on molecule v4 tests and latest galaxy meta compatibility + 2.0.0: * Remove python2 support * Update tests to github actions