diff --git a/.ansible-lint b/.ansible-lint index f777db8..f9251eb 100644 --- a/.ansible-lint +++ b/.ansible-lint @@ -23,9 +23,13 @@ warn_list: - no-handler - fqcn-builtins - no-log-password + - jinja[spacing] + - jinja[invalid] + - meta-no-tags skip_list: - vars_should_not_be_used + - file_is_small_enough use_default_rules: true parseable: true diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7c96b1d..85da941 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,11 +1,16 @@ --- name: CI -"on": +on: push: branches: - main pull_request: +env: + COLORTERM: 'yes' + TERM: 'xterm-256color' + PYTEST_ADDOPTS: '--color=yes' + jobs: ci: runs-on: ubuntu-latest @@ -29,16 +34,17 @@ jobs: pip install yamllint 'molecule[docker]~=3.5.2' ansible-core flake8 ansible-lint voluptuous pip install -r ansible_collections/middleware_automation/keycloak/requirements.txt + - name: Create default collection path + run: | + mkdir -p /home/runner/.ansible/ + ln -s /home/runner/work/keycloak/keycloak /home/runner/.ansible/collections + - name: Install ansible-lint custom rules uses: actions/checkout@v2 with: repository: ansible-middleware/ansible-lint-custom-rules path: ansible_collections/ansible-lint-custom-rules/ - - name: Create default collection path - run: | - mkdir -p /home/runner/.ansible/collections/ansible_collections - - name: Run sanity tests run: ansible-test sanity --docker -v --color --python ${{ matrix.python_version }} --exclude changelogs/fragments/.gitignore working-directory: ./ansible_collections/middleware_automation/keycloak diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 7345971..7163a00 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -45,7 +45,8 @@ jobs: - name: Create default collection path run: | - mkdir -p /home/runner/.ansible/collections/ansible_collections + mkdir -p /home/runner/.ansible/ + ln -s /home/runner/work/keycloak/keycloak /home/runner/.ansible/collections - name: Create changelog and documentation uses: ansible-middleware/collection-docs-action@main diff --git a/galaxy.yml b/galaxy.yml index 6a9e648..e3c6bfb 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -28,8 +28,15 @@ documentation: https://ansible-middleware.github.io/keycloak homepage: https://github.com/ansible-middleware/keycloak issues: https://github.com/ansible-middleware/keycloak/issues build_ignore: - - molecule + - .gitignore - .github + - .ansible-lint + - .yamllint - '*.tar.gz' - '*.zip' - - changelogs/fragments/.gitignore + - molecule + - changelogs + - docs/_gh_include + - docs/conf.py + - docs/roles.rst.template + - docs/requirements.yml diff --git a/molecule/default/prepare.yml b/molecule/default/prepare.yml index 40923c9..1d78e2d 100644 --- a/molecule/default/prepare.yml +++ b/molecule/default/prepare.yml @@ -8,3 +8,13 @@ - sudo - java-1.8.0-openjdk state: present + +- name: Prepare + hosts: all + tasks: + - name: "Run preparation common to all scenario" + ansible.builtin.include_tasks: ../prepare.yml + vars: + assets: + - "{{ assets_server }}/sso/7.5.0/rh-sso-7.5.0-server-dist.zip" + - "{{ assets_server }}/sso/7.5.1/rh-sso-7.5.1-patch.zip" diff --git a/molecule/overridexml/prepare.yml b/molecule/overridexml/prepare.yml index 03433c0..3fc1104 100644 --- a/molecule/overridexml/prepare.yml +++ b/molecule/overridexml/prepare.yml @@ -2,11 +2,8 @@ - name: Prepare hosts: all tasks: - - name: Disable beta repos - ansible.builtin.command: yum config-manager --disable '*beta*' - ignore_errors: yes - - - name: Install sudo - ansible.builtin.yum: - name: sudo - state: present + - name: "Run preparation common to all scenario" + ansible.builtin.include_tasks: ../prepare.yml + vars: + assets: + - "{{ assets_server }}/sso/7.5.0/rh-sso-7.5.0-server-dist.zip" diff --git a/molecule/prepare.yml b/molecule/prepare.yml new file mode 100644 index 0000000..c457571 --- /dev/null +++ b/molecule/prepare.yml @@ -0,0 +1,28 @@ +--- +- name: Display Ansible version + ansible.builtin.debug: + msg: "Ansible version is {{ ansible_version.full }}" + +- name: Install sudo + ansible.builtin.yum: + name: + - sudo + - iproute + state: present + +- name: "Retrieve assets server from env" + ansible.builtin.set_fact: + assets_server: "{{ lookup('env','MIDDLEWARE_DOWNLOAD_RELEASE_SERVER_URL') }}" + +- name: "Download and deploy jws zips from {{ assets_server }}" + ansible.builtin.get_url: + url: "{{ asset }}" + dest: "{{ lookup('env', 'PWD') }}" + validate_certs: no + delegate_to: localhost + loop: "{{ assets }}" + loop_control: + loop_var: asset + when: + - assets_server is defined + - assets_server | length > 0