diff --git a/.ansible-lint b/.ansible-lint deleted file mode 100644 index 9439efb3..00000000 --- a/.ansible-lint +++ /dev/null @@ -1,8 +0,0 @@ -skip_list: - - '106' - - 'command-instead-of-module' - - 'risky-shell-pipe' - - 'role-name' - - 'line-length' - - 'fqcn-builtins' - - yaml # Violations reported by yamllint. diff --git a/.config/ansible-lint.yml b/.config/ansible-lint.yml new file mode 100644 index 00000000..f9476e58 --- /dev/null +++ b/.config/ansible-lint.yml @@ -0,0 +1,16 @@ +warn_list: + - schema[meta] + - name[missing] + - package-latest + - jinja[spacing] + - experimental # all rules tagged as experimental + - key-order[task] # Ensure specific order of keys in mappings. + - name[casing] +skip_list: + - '106' + - 'command-instead-of-module' + - 'risky-shell-pipe' + - 'role-name' + - 'line-length' + - 'fqcn-builtins' + - yaml # Violations reported by yamllint. diff --git a/.github/workflows/molecule.yml b/.github/workflows/test_full_stack.yml similarity index 86% rename from .github/workflows/molecule.yml rename to .github/workflows/test_full_stack.yml index e830bdea..c8408be2 100644 --- a/.github/workflows/molecule.yml +++ b/.github/workflows/test_full_stack.yml @@ -1,14 +1,11 @@ --- -name: Molecule Test +name: Test ElasticStack on: push: tags: - - v* + - '*' branches: - main - - 'feature/**' - - 'fix/**' - - '!doc/**' pull_request: branches: - 'feature/**' @@ -24,10 +21,13 @@ jobs: COLLECTION_NAME: elasticstack strategy: + fail-fast: false max-parallel: 1 matrix: - distro: [ubuntu2204] - scenario: [default, cluster, cluster-oss, no-security] + distro: + - ubuntu2204 + scenario: + - elasticstack_default steps: - name: Check out code @@ -48,7 +48,6 @@ jobs: mkdir -p ~/.ansible/collections/ansible_collections/$COLLECTION_NAMESPACE cp -a ../ansible-collection-$COLLECTION_NAME ~/.ansible/collections/ansible_collections/$COLLECTION_NAMESPACE/$COLLECTION_NAME - - name: Test with molecule run: | molecule test -s ${{ matrix.scenario }} diff --git a/.github/workflows/test_role_beats.yml b/.github/workflows/test_role_beats.yml new file mode 100644 index 00000000..9fde9e65 --- /dev/null +++ b/.github/workflows/test_role_beats.yml @@ -0,0 +1,100 @@ +--- +name: Test Role beats +on: + workflow_dispatch: + inputs: + logLevel: + description: 'Log level' + required: true + default: 'warning' + type: choice + options: + - info + - warning + - debug + push: + branches: + - 'feature/**' + - 'fix/**' + - '!doc/**' + paths: + - 'roles/beats/**' + - '.github/workflows/test_role_beats.yml' + - 'molecule/beats_**' + - '.config/ansible-lint.yml' + - '.yamllint' + pull_request: + branches: + - 'feature/**' + - 'fix/**' + - '!doc/**' + paths: + - 'roles/beats/**' + - '.github/workflows/test_role_beats.yml' + - 'molecule/beats_**' + - '.config/ansible-lint.yml' + - '.yamllint' + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - name: Check out the codebase. + uses: actions/checkout@v3 + + - name: Set up Python 3. + uses: actions/setup-python@v4 + with: + python-version: '3.x' + + - name: Install test dependencies. + run: | + python3 -m pip install --upgrade pip + python3 -m pip install yamllint ansible-lint + + - name: Lint code. + run: | + yamllint roles/beats/ + ansible-lint roles/beats/ + + build: + needs: lint + runs-on: ubuntu-latest + + env: + COLLECTION_NAMESPACE: NETWAYS + COLLECTION_NAME: elasticstack + + strategy: + fail-fast: false + max-parallel: 1 + matrix: + distro: [debian11, rockylinux8, ubuntu2204] + scenario: [beats_default, beats_full_stack, beats_peculiar] + + steps: + - name: Check out code + uses: actions/checkout@v3 + + - name: Set up Python 3.8 + uses: actions/setup-python@v3 + with: + python-version: 3.8 + + - name: Install dependencies + run: | + python3 -m pip install --upgrade pip + python3 -m pip install -r requirements-test.txt + + - name: Install collection + run: | + mkdir -p ~/.ansible/collections/ansible_collections/$COLLECTION_NAMESPACE + cp -a ../ansible-collection-$COLLECTION_NAME ~/.ansible/collections/ansible_collections/$COLLECTION_NAMESPACE/$COLLECTION_NAME + + - name: Test with molecule + run: | + molecule test -s ${{ matrix.scenario }} + env: + MOLECULE_DISTRO: ${{ matrix.distro }} + PY_COLORS: '1' + ANSIBLE_FORCE_COLOR: '1' diff --git a/.github/workflows/test_role_elasticsearch.yml b/.github/workflows/test_role_elasticsearch.yml new file mode 100644 index 00000000..99a06f43 --- /dev/null +++ b/.github/workflows/test_role_elasticsearch.yml @@ -0,0 +1,100 @@ +--- +name: Test Role elasticsearch +on: + workflow_dispatch: + inputs: + logLevel: + description: 'Log level' + required: true + default: 'warning' + type: choice + options: + - info + - warning + - debug + push: + branches: + - 'feature/**' + - 'fix/**' + - '!doc/**' + paths: + - 'roles/elasticsearch/**' + - '.github/workflows/test_role_elasticsearch.yml' + - 'molecule/elasticsearch_**' + - '.config/ansible-lint.yml' + - '.yamllint' + pull_request: + branches: + - 'feature/**' + - 'fix/**' + - '!doc/**' + paths: + - 'roles/elasticsearch/**' + - '.github/workflows/test_role_elasticsearch.yml' + - 'molecule/elasticsearch_**' + - '.config/ansible-lint.yml' + - '.yamllint' + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - name: Check out the codebase. + uses: actions/checkout@v3 + + - name: Set up Python 3. + uses: actions/setup-python@v4 + with: + python-version: '3.x' + + - name: Install test dependencies. + run: | + python3 -m pip install --upgrade pip + python3 -m pip install yamllint ansible-lint + + - name: Lint code. + run: | + yamllint roles/elasticsearch/ + ansible-lint roles/elasticsearch/ + + build: + needs: lint + runs-on: ubuntu-latest + + env: + COLLECTION_NAMESPACE: NETWAYS + COLLECTION_NAME: elasticstack + + strategy: + fail-fast: false + max-parallel: 1 + matrix: + distro: [ubuntu2204] + scenario: [elasticsearch_default, elasticsearch_cluster, elasticsearch_cluster-oss, elasticsearch_no-security] + + steps: + - name: Check out code + uses: actions/checkout@v3 + + - name: Set up Python 3.8 + uses: actions/setup-python@v3 + with: + python-version: 3.8 + + - name: Install dependencies + run: | + python3 -m pip install --upgrade pip + python3 -m pip install -r requirements-test.txt + + - name: Install collection + run: | + mkdir -p ~/.ansible/collections/ansible_collections/$COLLECTION_NAMESPACE + cp -a ../ansible-collection-$COLLECTION_NAME ~/.ansible/collections/ansible_collections/$COLLECTION_NAMESPACE/$COLLECTION_NAME + + - name: Test with molecule + run: | + molecule test -s ${{ matrix.scenario }} + env: + MOLECULE_DISTRO: ${{ matrix.distro }} + PY_COLORS: '1' + ANSIBLE_FORCE_COLOR: '1' diff --git a/.github/workflows/test_role_kibana.yml b/.github/workflows/test_role_kibana.yml new file mode 100644 index 00000000..9d28ab5b --- /dev/null +++ b/.github/workflows/test_role_kibana.yml @@ -0,0 +1,98 @@ +--- +name: Test Role Kibana +on: + workflow_dispatch: + inputs: + logLevel: + description: 'Log level' + required: true + default: 'warning' + type: choice + options: + - info + - warning + - debug + push: + branches: + - 'feature/**' + - 'fix/**' + - '!doc/**' + paths: + - 'roles/kibana/**' + - '.github/workflows/test_role_kibana.yml' + - 'molecule/kibana_**' + - '.config/ansible-lint.yml' + - '.yamllint' + pull_request: + branches: + - 'feature/**' + - 'fix/**' + - '!doc/**' + paths: + - 'roles/kibana/**' + - '.github/workflows/test_role_kibana.yml' + - 'molecule/kibana_**' + - '.config/ansible-lint.yml' + - '.yamllint' + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - name: Check out the codebase. + uses: actions/checkout@v3 + + - name: Set up Python 3. + uses: actions/setup-python@v4 + with: + python-version: '3.x' + + - name: Install test dependencies. + run: | + python3 -m pip install --upgrade pip + python3 -m pip install yamllint ansible-lint + + - name: Lint code. + run: | + yamllint roles/kibana/ + ansible-lint roles/kibana/ + + build: + needs: lint + runs-on: ubuntu-latest + + env: + COLLECTION_NAMESPACE: NETWAYS + COLLECTION_NAME: elasticstack + + strategy: + fail-fast: false + max-parallel: 3 + matrix: + distro: [ubuntu2204] + scenario: [kibana_default, kibana_full_stack, kibana_full_stack-oss] + + steps: + - name: Check out code + uses: actions/checkout@v2 + + - name: Set up Python 3.8 + uses: actions/setup-python@v2 + with: + python-version: 3.8 + + - name: Install dependencies + run: | + python3 -m pip install --upgrade pip + python3 -m pip install -r requirements-test.txt + + - name: Install collection + run: | + mkdir -p ~/.ansible/collections/ansible_collections/$COLLECTION_NAMESPACE + cp -a ../ansible-collection-$COLLECTION_NAME ~/.ansible/collections/ansible_collections/$COLLECTION_NAMESPACE/$COLLECTION_NAME + + - name: Test with molecule + run: | + molecule test -s ${{ matrix.scenario }} + env: + MOLECULE_DISTRO: ${{ matrix.distro }} diff --git a/roles/logstash/.github/workflows/molecule.yml b/.github/workflows/test_role_logstash.yml similarity index 51% rename from roles/logstash/.github/workflows/molecule.yml rename to .github/workflows/test_role_logstash.yml index 6f6fcdd8..a0387503 100644 --- a/roles/logstash/.github/workflows/molecule.yml +++ b/.github/workflows/test_role_logstash.yml @@ -1,12 +1,39 @@ --- -name: Molecule Test +name: Test Role Logstash on: + workflow_dispatch: + inputs: + logLevel: + description: 'Log level' + required: true + default: 'warning' + type: choice + options: + - info + - warning + - debug push: - tags: - - v* branches: - - master + - 'feature/**' + - 'fix/**' + - '!doc/**' + paths: + - 'roles/logstash/**' + - '.github/workflows/test_role_logstash.yml' + - 'molecule/logstash_**' + - '.config/ansible-lint.yml' + - '.yamllint' pull_request: + branches: + - 'feature/**' + - 'fix/**' + - '!doc/**' + paths: + - 'roles/logstash/**' + - '.github/workflows/test_role_logstash.yml' + - 'molecule/logstash_**' + - '.config/ansible-lint.yml' + - '.yamllint' jobs: lint: @@ -27,20 +54,21 @@ jobs: - name: Lint code. run: | - yamllint . - ansible-lint . - env: - MOLECULE_DISTRO: ${{ matrix.distro }} - PY_COLORS: '1' + yamllint roles/logstash/ + ansible-lint roles/logstash/ molecule_default: runs-on: ubuntu-latest needs: lint + env: + COLLECTION_NAMESPACE: NETWAYS + COLLECTION_NAME: elasticstack + strategy: matrix: distro: [ubuntu2204] - scenario: [default] + scenario: [logstash_default] steps: - name: Check out code @@ -56,6 +84,11 @@ jobs: python3 -m pip install --upgrade pip python3 -m pip install -r requirements-test.txt + - name: Install collection + run: | + mkdir -p ~/.ansible/collections/ansible_collections/$COLLECTION_NAMESPACE + cp -a ../ansible-collection-$COLLECTION_NAME ~/.ansible/collections/ansible_collections/$COLLECTION_NAMESPACE/$COLLECTION_NAME + - name: Test with molecule run: | molecule test -s ${{ matrix.scenario }} @@ -68,15 +101,20 @@ jobs: runs-on: ubuntu-latest needs: molecule_default + env: + COLLECTION_NAMESPACE: NETWAYS + COLLECTION_NAME: elasticstack + strategy: + fail-fast: false max-parallel: 1 matrix: distro: [ubuntu2204] - scenario: [run_logstash, - full_stack, - full_stack-oss, - specific_version, - pipelines] + scenario: [logstash_run_logstash, + logstash_full_stack, + logstash_full_stack-oss, + logstash_specific_version, + logstash_pipelines] steps: - name: Check out code @@ -92,6 +130,11 @@ jobs: python3 -m pip install --upgrade pip python3 -m pip install -r requirements-test.txt + - name: Install collection + run: | + mkdir -p ~/.ansible/collections/ansible_collections/$COLLECTION_NAMESPACE + cp -a ../ansible-collection-$COLLECTION_NAME ~/.ansible/collections/ansible_collections/$COLLECTION_NAMESPACE/$COLLECTION_NAME + - name: Test with molecule run: | molecule test -s ${{ matrix.scenario }} diff --git a/.github/workflows/test_role_repos.yml b/.github/workflows/test_role_repos.yml new file mode 100644 index 00000000..8be30a8e --- /dev/null +++ b/.github/workflows/test_role_repos.yml @@ -0,0 +1,99 @@ +name: Test Role repos +on: + workflow_dispatch: + inputs: + logLevel: + description: 'Log level' + required: true + default: 'warning' + type: choice + options: + - info + - warning + - debug + push: + branches: + - 'feature/**' + - 'fix/**' + - '!doc/**' + paths: + - 'roles/repos/**' + - '.github/workflows/test_role_repos.yml' + - 'molecule/repos_**' + - '.config/ansible-lint.yml' + - '.yamllint' + pull_request: + branches: + - 'feature/**' + - 'fix/**' + - '!doc/**' + paths: + - 'roles/repos/**' + - '.github/workflows/test_role_repos.yml' + - 'molecule/repos_**' + - '.config/ansible-lint.yml' + - '.yamllint' + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - name: Check out the codebase. + uses: actions/checkout@v3 + + - name: Set up Python 3. + uses: actions/setup-python@v4 + with: + python-version: '3.x' + + - name: Install test dependencies. + run: | + python3 -m pip install --upgrade pip + python3 -m pip install yamllint ansible-lint + + - name: Lint code. + run: | + yamllint roles/repos/ + ansible-lint roles/repos/ + + build: + needs: lint + runs-on: ubuntu-latest + + env: + COLLECTION_NAMESPACE: NETWAYS + COLLECTION_NAME: elasticstack + + strategy: + fail-fast: false + max-parallel: 4 + matrix: + + distro: [centos7, debian10, debian11, rockylinux8, rockylinux9, ubuntu2004, ubuntu2204] + scenario: [repos_default, repos_oss, repos_elastic8] + + steps: + - name: Check out code + uses: actions/checkout@v2 + + - name: Set up Python 3.8 + uses: actions/setup-python@v2 + with: + python-version: 3.8 + + - name: Install dependencies + run: | + python3 -m pip install --upgrade pip + python3 -m pip install -r requirements-test.txt + ansible-galaxy collection install community.general + + - name: Install collection + run: | + mkdir -p ~/.ansible/collections/ansible_collections/$COLLECTION_NAMESPACE + cp -a ../ansible-collection-$COLLECTION_NAME ~/.ansible/collections/ansible_collections/$COLLECTION_NAMESPACE/$COLLECTION_NAME + + - name: Test with molecule + run: | + molecule test -s ${{ matrix.scenario }} + env: + MOLECULE_DISTRO: ${{ matrix.distro }} diff --git a/roles/beats/.github/workflows/molecule.yml b/.github/workflows/test_roles_pr.yml similarity index 50% rename from roles/beats/.github/workflows/molecule.yml rename to .github/workflows/test_roles_pr.yml index 6a912b1b..d3a57654 100644 --- a/roles/beats/.github/workflows/molecule.yml +++ b/.github/workflows/test_roles_pr.yml @@ -1,22 +1,33 @@ --- -name: Molecule Test +name: Test Collection Roles on: - push: - tags: - - v* - branches: - - master pull_request: + branches: + - main + - 'feature/**' + - 'fix/**' + - '!doc/**' jobs: build: runs-on: ubuntu-latest + env: + COLLECTION_NAMESPACE: NETWAYS + COLLECTION_NAME: elasticstack + strategy: + fail-fast: false max-parallel: 1 matrix: - distro: [debian11, rockylinux8, ubuntu2204] - scenario: [default, full_stack, peculiar] + distro: + - ubuntu2204 + scenario: + - beats_default + - elasticsearch_default + - kibana_default + - logstash_default + - repos_default steps: - name: Check out code @@ -32,6 +43,11 @@ jobs: python3 -m pip install --upgrade pip python3 -m pip install -r requirements-test.txt + - name: Install collection + run: | + mkdir -p ~/.ansible/collections/ansible_collections/$COLLECTION_NAMESPACE + cp -a ../ansible-collection-$COLLECTION_NAME ~/.ansible/collections/ansible_collections/$COLLECTION_NAMESPACE/$COLLECTION_NAME + - name: Test with molecule run: | molecule test -s ${{ matrix.scenario }} diff --git a/.yamllint b/.yamllint index 1f203667..b9d032d6 100644 --- a/.yamllint +++ b/.yamllint @@ -1,2 +1,5 @@ --- extends: relaxed + +rules: + line-length: disable diff --git a/docs/role-beats.md b/docs/role-beats.md index d5bebaaa..49a72aa3 100644 --- a/docs/role-beats.md +++ b/docs/role-beats.md @@ -1,7 +1,7 @@ Ansible Role: Beats ========= -[![CI](https://github.com/NETWAYS/ansible-role-beats/workflows/Molecule%20Test/badge.svg?event=push)](https://github.com/NETWAYS/ansible-role-beats/workflows/Molecule%20Test/badge.svg) +[![CI](https://github.com/NETWAYS/ansible-collection-elasticstack/workflows/Test%20Role%20beats/badge.svg?event=push)](https://github.com/NETWAYS/ansible-collection-elasticstack/workflows/Test%20Role%20beats/badge.svg) This role installs and configures Beats. You can use it as a standalone role or combine it with our other roles managing the Elastic Stack. diff --git a/molecule/beats/molecule/default/requirements.yml b/molecule/beats/molecule/default/requirements.yml deleted file mode 100644 index 67222f5c..00000000 --- a/molecule/beats/molecule/default/requirements.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- -- name: elastic-repos - src: https://github.com/NETWAYS/ansible-role-elastic-repos - scm: git diff --git a/molecule/beats/molecule/peculiar/requirements.yml b/molecule/beats/molecule/peculiar/requirements.yml deleted file mode 100644 index 67222f5c..00000000 --- a/molecule/beats/molecule/peculiar/requirements.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- -- name: elastic-repos - src: https://github.com/NETWAYS/ansible-role-elastic-repos - scm: git diff --git a/molecule/beats/molecule/default/converge.yml b/molecule/beats_default/converge.yml similarity index 70% rename from molecule/beats/molecule/default/converge.yml rename to molecule/beats_default/converge.yml index 7eda049b..72255217 100644 --- a/molecule/beats/molecule/default/converge.yml +++ b/molecule/beats_default/converge.yml @@ -5,13 +5,15 @@ # https://github.com/ansible-community/molecule/issues/1567#issuecomment-436876722 - name: Converge hosts: all + collections: + - NETWAYS.elasticstack vars: elasticsearch_jna_workaround: true elasticsearch_disable_systemcallfilterchecks: true tasks: - - name: "Include Elastics repos role" + - name: Include Elastics repos role include_role: - name: elastic-repos - - name: "Include Beats" + name: repos + - name: Include Beats include_role: - name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}" + name: beats diff --git a/molecule/beats/molecule/default/molecule.yml b/molecule/beats_default/molecule.yml similarity index 89% rename from molecule/beats/molecule/default/molecule.yml rename to molecule/beats_default/molecule.yml index 4fd2ef1a..9e57f3c0 100644 --- a/molecule/beats/molecule/default/molecule.yml +++ b/molecule/beats_default/molecule.yml @@ -16,7 +16,3 @@ provisioner: name: ansible verifier: name: ansible -lint: | - set -e - yamllint . - ansible-lint . diff --git a/molecule/beats/molecule/default/prepare.yml b/molecule/beats_default/prepare.yml similarity index 100% rename from molecule/beats/molecule/default/prepare.yml rename to molecule/beats_default/prepare.yml diff --git a/molecule/beats/molecule/default/verify.yml b/molecule/beats_default/verify.yml similarity index 100% rename from molecule/beats/molecule/default/verify.yml rename to molecule/beats_default/verify.yml diff --git a/molecule/beats/molecule/full_stack/converge.yml b/molecule/beats_full_stack/converge.yml similarity index 95% rename from molecule/beats/molecule/full_stack/converge.yml rename to molecule/beats_full_stack/converge.yml index 89ba6c96..28fab1f4 100644 --- a/molecule/beats/molecule/full_stack/converge.yml +++ b/molecule/beats_full_stack/converge.yml @@ -5,6 +5,8 @@ # https://github.com/ansible-community/molecule/issues/1567#issuecomment-436876722 - name: Converge hosts: all + collections: + - NETWAYS.elasticstack vars: elastic_stack_full_stack: true filebeat_syslog_udp: true @@ -18,7 +20,7 @@ tasks: - name: Include Elastics repos role include_role: - name: elastic-repos + name: repos - name: Install rsyslog package: name: rsyslog diff --git a/molecule/beats/molecule/full_stack/molecule.yml b/molecule/beats_full_stack/molecule.yml similarity index 100% rename from molecule/beats/molecule/full_stack/molecule.yml rename to molecule/beats_full_stack/molecule.yml diff --git a/molecule/beats/molecule/full_stack/prepare.yml b/molecule/beats_full_stack/prepare.yml similarity index 100% rename from molecule/beats/molecule/full_stack/prepare.yml rename to molecule/beats_full_stack/prepare.yml diff --git a/molecule/beats/molecule/full_stack/requirements.yml b/molecule/beats_full_stack/requirements.yml similarity index 100% rename from molecule/beats/molecule/full_stack/requirements.yml rename to molecule/beats_full_stack/requirements.yml diff --git a/molecule/beats/molecule/full_stack/verify.yml b/molecule/beats_full_stack/verify.yml similarity index 100% rename from molecule/beats/molecule/full_stack/verify.yml rename to molecule/beats_full_stack/verify.yml diff --git a/molecule/beats/molecule/peculiar/converge.yml b/molecule/beats_peculiar/converge.yml similarity index 93% rename from molecule/beats/molecule/peculiar/converge.yml rename to molecule/beats_peculiar/converge.yml index 1caab995..fa7fd830 100644 --- a/molecule/beats/molecule/peculiar/converge.yml +++ b/molecule/beats_peculiar/converge.yml @@ -5,6 +5,8 @@ # https://github.com/ansible-community/molecule/issues/1567#issuecomment-436876722 - name: Converge hosts: all + collections: + - NETWAYS.elasticstack vars: filebeat_log_inputs: messages: @@ -44,7 +46,7 @@ - name: "Include Elastics repos role" include_role: - name: elastic-repos + name: repos - name: Refresh apt cache apt: @@ -54,4 +56,4 @@ - name: "Include Beats" include_role: - name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}" + name: beats diff --git a/molecule/beats/molecule/peculiar/molecule.yml b/molecule/beats_peculiar/molecule.yml similarity index 100% rename from molecule/beats/molecule/peculiar/molecule.yml rename to molecule/beats_peculiar/molecule.yml diff --git a/molecule/beats/molecule/peculiar/prepare.yml b/molecule/beats_peculiar/prepare.yml similarity index 100% rename from molecule/beats/molecule/peculiar/prepare.yml rename to molecule/beats_peculiar/prepare.yml diff --git a/molecule/beats/molecule/peculiar/verify.yml b/molecule/beats_peculiar/verify.yml similarity index 100% rename from molecule/beats/molecule/peculiar/verify.yml rename to molecule/beats_peculiar/verify.yml diff --git a/molecule/cluster-8/converge.yml b/molecule/elasticsearch_cluster-8/converge.yml similarity index 83% rename from molecule/cluster-8/converge.yml rename to molecule/elasticsearch_cluster-8/converge.yml index 9919a17d..8b3aaa6b 100644 --- a/molecule/cluster-8/converge.yml +++ b/molecule/elasticsearch_cluster-8/converge.yml @@ -3,6 +3,8 @@ # Found at: https://github.com/ansible-community/molecule/issues/1567#issuecomment-436876722 - name: Converge hosts: all + collections: + - NETWAYS.elasticstack vars: # elasticsearch_disable_systemcallfilterchecks: true elastic_release: 8 @@ -10,7 +12,7 @@ tasks: - name: "Include Elastics repos role" include_role: - name: elastic-repos + name: repos - name: "Include Elasticsearch" include_role: - name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}" + name: elasticsearch diff --git a/molecule/cluster-8/molecule.yml b/molecule/elasticsearch_cluster-8/molecule.yml similarity index 100% rename from molecule/cluster-8/molecule.yml rename to molecule/elasticsearch_cluster-8/molecule.yml diff --git a/molecule/cluster-8/prepare.yml b/molecule/elasticsearch_cluster-8/prepare.yml similarity index 100% rename from molecule/cluster-8/prepare.yml rename to molecule/elasticsearch_cluster-8/prepare.yml diff --git a/molecule/cluster-8/verify.yml b/molecule/elasticsearch_cluster-8/verify.yml similarity index 100% rename from molecule/cluster-8/verify.yml rename to molecule/elasticsearch_cluster-8/verify.yml diff --git a/molecule/cluster-oss/converge.yml b/molecule/elasticsearch_cluster-oss/converge.yml similarity index 100% rename from molecule/cluster-oss/converge.yml rename to molecule/elasticsearch_cluster-oss/converge.yml diff --git a/molecule/cluster-oss/molecule.yml b/molecule/elasticsearch_cluster-oss/molecule.yml similarity index 100% rename from molecule/cluster-oss/molecule.yml rename to molecule/elasticsearch_cluster-oss/molecule.yml diff --git a/molecule/cluster-oss/prepare.yml b/molecule/elasticsearch_cluster-oss/prepare.yml similarity index 100% rename from molecule/cluster-oss/prepare.yml rename to molecule/elasticsearch_cluster-oss/prepare.yml diff --git a/molecule/cluster/converge.yml b/molecule/elasticsearch_cluster/converge.yml similarity index 100% rename from molecule/cluster/converge.yml rename to molecule/elasticsearch_cluster/converge.yml diff --git a/molecule/cluster/molecule.yml b/molecule/elasticsearch_cluster/molecule.yml similarity index 100% rename from molecule/cluster/molecule.yml rename to molecule/elasticsearch_cluster/molecule.yml diff --git a/molecule/cluster/prepare.yml b/molecule/elasticsearch_cluster/prepare.yml similarity index 100% rename from molecule/cluster/prepare.yml rename to molecule/elasticsearch_cluster/prepare.yml diff --git a/molecule/default/converge.yml b/molecule/elasticsearch_default/converge.yml similarity index 100% rename from molecule/default/converge.yml rename to molecule/elasticsearch_default/converge.yml diff --git a/molecule/default/molecule.yml b/molecule/elasticsearch_default/molecule.yml similarity index 89% rename from molecule/default/molecule.yml rename to molecule/elasticsearch_default/molecule.yml index b7dcfa0e..2c25892d 100644 --- a/molecule/default/molecule.yml +++ b/molecule/elasticsearch_default/molecule.yml @@ -18,7 +18,3 @@ provisioner: name: ansible verifier: name: ansible -#lint: | -# set -e -# yamllint . -# ansible-lint . diff --git a/molecule/default/prepare.yml b/molecule/elasticsearch_default/prepare.yml similarity index 100% rename from molecule/default/prepare.yml rename to molecule/elasticsearch_default/prepare.yml diff --git a/molecule/no-security/converge.yml b/molecule/elasticsearch_no-security/converge.yml similarity index 100% rename from molecule/no-security/converge.yml rename to molecule/elasticsearch_no-security/converge.yml diff --git a/molecule/no-security/molecule.yml b/molecule/elasticsearch_no-security/molecule.yml similarity index 100% rename from molecule/no-security/molecule.yml rename to molecule/elasticsearch_no-security/molecule.yml diff --git a/molecule/no-security/prepare.yml b/molecule/elasticsearch_no-security/prepare.yml similarity index 100% rename from molecule/no-security/prepare.yml rename to molecule/elasticsearch_no-security/prepare.yml diff --git a/molecule/no-security/verify.yml b/molecule/elasticsearch_no-security/verify.yml similarity index 100% rename from molecule/no-security/verify.yml rename to molecule/elasticsearch_no-security/verify.yml diff --git a/molecule/elasticstack_default/converge.yml b/molecule/elasticstack_default/converge.yml new file mode 100644 index 00000000..b8b54f6c --- /dev/null +++ b/molecule/elasticstack_default/converge.yml @@ -0,0 +1,23 @@ +--- +- name: Converge + collections: + - NETWAYS.elasticstack + hosts: all + vars: + elasticsearch_jna_workaround: true + elasticsearch_disable_systemcallfilterchecks: true + elastic_stack_full_stack: true + elastic_variant: oss + tasks: + - name: Include Elastic Repos + include_role: + name: repos + - name: Include Elasticsearch role + include_role: + name: elasticsearch + - name: Include logstash + include_role: + name: logstash + - name: Include Kibana + include_role: + name: kibana diff --git a/molecule/elasticstack_default/molecule.yml b/molecule/elasticstack_default/molecule.yml new file mode 100644 index 00000000..56dd07f2 --- /dev/null +++ b/molecule/elasticstack_default/molecule.yml @@ -0,0 +1,30 @@ +--- +dependency: + name: galaxy +driver: + name: docker +platforms: + - name: elasticsearch-cluster1 + groups: + - elasticsearch + image: "geerlingguy/docker-${MOLECULE_DISTRO:-centos7}-ansible:latest" + command: ${MOLECULE_DOCKER_COMMAND:-""} + volumes: + - /sys/fs/cgroup:/sys/fs/cgroup:rw + cgroupns_mode: host + privileged: true + pre_build_image: true + - name: elasticsearch-cluster2 + groups: + - elasticsearch + image: "geerlingguy/docker-${MOLECULE_DISTRO:-centos7}-ansible:latest" + command: ${MOLECULE_DOCKER_COMMAND:-""} + volumes: + - /sys/fs/cgroup:/sys/fs/cgroup:rw + cgroupns_mode: host + privileged: true + pre_build_image: true +provisioner: + name: ansible +verifier: + name: ansible diff --git a/molecule/elasticstack_default/prepare.yml b/molecule/elasticstack_default/prepare.yml new file mode 100644 index 00000000..d6abc016 --- /dev/null +++ b/molecule/elasticstack_default/prepare.yml @@ -0,0 +1,36 @@ +--- +- name: Prepare + hosts: all + tasks: + - name: Refresh apt cache + apt: + update_cache: yes + when: ansible_os_family == "Debian" + + - name: Install git + package: + name: git + + - name: Install packages for RHEL + package: + name: + - iproute + - NetworkManager + when: ansible_os_family == "RedHat" + + - name: Start NetworkManager + service: + name: NetworkManager + state: started + enabled: yes + when: ansible_os_family == "RedHat" + + - name: Install packages for Debian + package: + name: + - gpg + - gpg-agent + - procps + - curl + - iproute2 + when: ansible_os_family == "Debian" diff --git a/roles/kibana/molecule/default/converge.yml b/molecule/kibana_default/converge.yml similarity index 64% rename from roles/kibana/molecule/default/converge.yml rename to molecule/kibana_default/converge.yml index 0091ae42..0be4ad7a 100644 --- a/roles/kibana/molecule/default/converge.yml +++ b/molecule/kibana_default/converge.yml @@ -5,10 +5,12 @@ # https://github.com/ansible-community/molecule/issues/1567#issuecomment-436876722 - name: Converge hosts: all + collections: + - NETWAYS.elasticstack tasks: - - name: "Include Elastic Repos" + - name: Include Elastic Repos include_role: - name: "elastic-repos" - - name: "Include Kibana" + name: repos + - name: Include Kibana include_role: - name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}" + name: kibana diff --git a/roles/kibana/molecule/default/molecule.yml b/molecule/kibana_default/molecule.yml similarity index 79% rename from roles/kibana/molecule/default/molecule.yml rename to molecule/kibana_default/molecule.yml index 868facf5..d279313b 100644 --- a/roles/kibana/molecule/default/molecule.yml +++ b/molecule/kibana_default/molecule.yml @@ -7,13 +7,12 @@ platforms: - name: kibana_default image: "geerlingguy/docker-${MOLECULE_DISTRO:-centos7}-ansible:latest" command: ${MOLECULE_DOCKER_COMMAND:-""} + volumes: + - /sys/fs/cgroup:/sys/fs/cgroup:rw + cgroupns_mode: host privileged: true pre_build_image: true provisioner: name: ansible verifier: name: ansible -lint: | - set -e - yamllint . - ansible-lint . diff --git a/molecule/tmp_kibana/kibana_full_stack/prepare.yml b/molecule/kibana_default/prepare.yml similarity index 100% rename from molecule/tmp_kibana/kibana_full_stack/prepare.yml rename to molecule/kibana_default/prepare.yml diff --git a/molecule/tmp_kibana/kibana_full_stack/converge.yml b/molecule/kibana_full_stack/converge.yml similarity index 93% rename from molecule/tmp_kibana/kibana_full_stack/converge.yml rename to molecule/kibana_full_stack/converge.yml index acda95a7..af39cc3b 100644 --- a/molecule/tmp_kibana/kibana_full_stack/converge.yml +++ b/molecule/kibana_full_stack/converge.yml @@ -5,6 +5,8 @@ # https://github.com/ansible-community/molecule/issues/1567#issuecomment-436876722 - name: Converge hosts: all + collections: + - NETWAYS.elasticstack vars: elastic_stack_full_stack: true tasks: diff --git a/molecule/tmp_kibana/kibana_full_stack/molecule.yml b/molecule/kibana_full_stack/molecule.yml similarity index 82% rename from molecule/tmp_kibana/kibana_full_stack/molecule.yml rename to molecule/kibana_full_stack/molecule.yml index 405f67f1..e0ef86e2 100644 --- a/molecule/tmp_kibana/kibana_full_stack/molecule.yml +++ b/molecule/kibana_full_stack/molecule.yml @@ -10,6 +10,9 @@ platforms: - kibana image: "geerlingguy/docker-${MOLECULE_DISTRO:-centos7}-ansible:latest" command: ${MOLECULE_DOCKER_COMMAND:-""} + volumes: + - /sys/fs/cgroup:/sys/fs/cgroup:rw + cgroupns_mode: host privileged: true pre_build_image: true provisioner: diff --git a/roles/kibana/molecule/default/prepare.yml b/molecule/kibana_full_stack/prepare.yml similarity index 100% rename from roles/kibana/molecule/default/prepare.yml rename to molecule/kibana_full_stack/prepare.yml diff --git a/molecule/tmp_kibana/kibana_full_stack/verify.yml b/molecule/kibana_full_stack/verify.yml similarity index 100% rename from molecule/tmp_kibana/kibana_full_stack/verify.yml rename to molecule/kibana_full_stack/verify.yml diff --git a/roles/logstash/molecule/default/converge.yml b/molecule/logstash_default/converge.yml similarity index 63% rename from roles/logstash/molecule/default/converge.yml rename to molecule/logstash_default/converge.yml index 1c223401..a0e058a0 100644 --- a/roles/logstash/molecule/default/converge.yml +++ b/molecule/logstash_default/converge.yml @@ -5,10 +5,12 @@ # https://github.com/ansible-community/molecule/issues/1567#issuecomment-436876722 - name: Converge hosts: all + collections: + - NETWAYS.elasticstack tasks: - - name: "Include Elastics repos role" + - name: Include Elastics repos role include_role: - name: elastic-repos - - name: "Include Logstash" + name: repos + - name: Include Logstash include_role: - name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}" + name: logstash diff --git a/roles/logstash/molecule/default/molecule.yml b/molecule/logstash_default/molecule.yml similarity index 89% rename from roles/logstash/molecule/default/molecule.yml rename to molecule/logstash_default/molecule.yml index d2c41917..abb31a5e 100644 --- a/roles/logstash/molecule/default/molecule.yml +++ b/molecule/logstash_default/molecule.yml @@ -16,7 +16,3 @@ provisioner: name: ansible verifier: name: ansible -lint: | - set -e - yamllint . - ansible-lint . diff --git a/roles/logstash/molecule/default/prepare.yml b/molecule/logstash_default/prepare.yml similarity index 100% rename from roles/logstash/molecule/default/prepare.yml rename to molecule/logstash_default/prepare.yml diff --git a/molecule/logstash_default/requirements.yml b/molecule/logstash_default/requirements.yml new file mode 100644 index 00000000..8dd51618 --- /dev/null +++ b/molecule/logstash_default/requirements.yml @@ -0,0 +1,3 @@ +--- +collections: + - community.general diff --git a/roles/logstash/molecule/full_stack-oss/converge.yml b/molecule/logstash_full_stack-oss/converge.yml similarity index 93% rename from roles/logstash/molecule/full_stack-oss/converge.yml rename to molecule/logstash_full_stack-oss/converge.yml index 3fac731a..651e89b2 100644 --- a/roles/logstash/molecule/full_stack-oss/converge.yml +++ b/molecule/logstash_full_stack-oss/converge.yml @@ -11,6 +11,8 @@ # Logstash - name: Converge hosts: all + collections: + - NETWAYS.elasticstack vars: elastic_stack_full_stack: true elastic_variant: oss @@ -22,7 +24,7 @@ tasks: - name: "Include Elastics repos role" include_role: - name: elastic-repos + name: repos - name: Install rsyslog package: name: rsyslog @@ -41,7 +43,7 @@ name: geerlingguy.redis - name: "Include Logstash" include_role: - name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}" + name: logstash - name: Configure rsyslog lineinfile: line: "*.* @@localhost:514" diff --git a/roles/logstash/molecule/full_stack-oss/molecule.yml b/molecule/logstash_full_stack-oss/molecule.yml similarity index 100% rename from roles/logstash/molecule/full_stack-oss/molecule.yml rename to molecule/logstash_full_stack-oss/molecule.yml diff --git a/roles/logstash/molecule/full_stack-oss/prepare.yml b/molecule/logstash_full_stack-oss/prepare.yml similarity index 100% rename from roles/logstash/molecule/full_stack-oss/prepare.yml rename to molecule/logstash_full_stack-oss/prepare.yml diff --git a/roles/logstash/molecule/specific_version/requirements.yml b/molecule/logstash_full_stack-oss/requirements.yml similarity index 62% rename from roles/logstash/molecule/specific_version/requirements.yml rename to molecule/logstash_full_stack-oss/requirements.yml index 5d8c1146..a0014bbc 100644 --- a/roles/logstash/molecule/specific_version/requirements.yml +++ b/molecule/logstash_full_stack-oss/requirements.yml @@ -1,8 +1,5 @@ --- roles: - - name: elastic-repos - src: https://github.com/NETWAYS/ansible-role-elastic-repos - scm: git # Versions 1.7.0 and 1.8.0 seem to have a problem with idempotency - name: geerlingguy.redis version: "1.6.0" diff --git a/roles/logstash/molecule/full_stack-oss/verify.yml b/molecule/logstash_full_stack-oss/verify.yml similarity index 100% rename from roles/logstash/molecule/full_stack-oss/verify.yml rename to molecule/logstash_full_stack-oss/verify.yml diff --git a/roles/logstash/molecule/full_stack/converge.yml b/molecule/logstash_full_stack/converge.yml similarity index 77% rename from roles/logstash/molecule/full_stack/converge.yml rename to molecule/logstash_full_stack/converge.yml index 5a3255ed..30185bdd 100644 --- a/roles/logstash/molecule/full_stack/converge.yml +++ b/molecule/logstash_full_stack/converge.yml @@ -5,14 +5,16 @@ # https://github.com/ansible-community/molecule/issues/1567#issuecomment-436876722 - name: Converge hosts: all + collections: + - NETWAYS.elasticstack vars: elastic_stack_full_stack: true filebeat_syslog_udp: true filebeat_syslog_tcp: true tasks: - - name: "Include Elastics repos role" + - name: Include repos role include_role: - name: elastic-repos + name: repos - name: Install rsyslog package: name: rsyslog @@ -20,18 +22,18 @@ service: name: rsyslog state: started - - name: "Include Elasticsearch role" + - name: Include Elasticsearch role include_role: name: elasticsearch - - name: "Include Beats" + - name: Include Beats include_role: name: beats - - name: "Include Redis" + - name: Include Redis include_role: name: geerlingguy.redis - - name: "Include Logstash" + - name: Include Logstash include_role: - name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}" + name: logstash - name: Configure rsyslog lineinfile: line: "*.* @@localhost:514" diff --git a/roles/logstash/molecule/full_stack/molecule.yml b/molecule/logstash_full_stack/molecule.yml similarity index 100% rename from roles/logstash/molecule/full_stack/molecule.yml rename to molecule/logstash_full_stack/molecule.yml diff --git a/roles/logstash/molecule/full_stack/prepare.yml b/molecule/logstash_full_stack/prepare.yml similarity index 100% rename from roles/logstash/molecule/full_stack/prepare.yml rename to molecule/logstash_full_stack/prepare.yml diff --git a/roles/logstash/molecule/pipelines/requirements.yml b/molecule/logstash_full_stack/requirements.yml similarity index 62% rename from roles/logstash/molecule/pipelines/requirements.yml rename to molecule/logstash_full_stack/requirements.yml index 5d8c1146..a0014bbc 100644 --- a/roles/logstash/molecule/pipelines/requirements.yml +++ b/molecule/logstash_full_stack/requirements.yml @@ -1,8 +1,5 @@ --- roles: - - name: elastic-repos - src: https://github.com/NETWAYS/ansible-role-elastic-repos - scm: git # Versions 1.7.0 and 1.8.0 seem to have a problem with idempotency - name: geerlingguy.redis version: "1.6.0" diff --git a/roles/logstash/molecule/full_stack/verify.yml b/molecule/logstash_full_stack/verify.yml similarity index 100% rename from roles/logstash/molecule/full_stack/verify.yml rename to molecule/logstash_full_stack/verify.yml diff --git a/roles/logstash/molecule/pipelines/converge.yml b/molecule/logstash_pipelines/converge.yml similarity index 91% rename from roles/logstash/molecule/pipelines/converge.yml rename to molecule/logstash_pipelines/converge.yml index 4aaa10a3..7ba9141d 100644 --- a/roles/logstash/molecule/pipelines/converge.yml +++ b/molecule/logstash_pipelines/converge.yml @@ -6,6 +6,8 @@ # https://github.com/ansible-community/molecule/issues/1567#issuecomment-436876722 - name: Converge hosts: all + collections: + - NETWAYS.elasticstack vars: logstash_enable: true logstash_pipelines: @@ -30,10 +32,10 @@ tasks: - name: "Include Elastics repos role" include_role: - name: elastic-repos + name: repos - name: "Include Redis" include_role: name: geerlingguy.redis - name: "Include Logstash" include_role: - name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}" + name: logstash diff --git a/roles/logstash/molecule/pipelines/molecule.yml b/molecule/logstash_pipelines/molecule.yml similarity index 100% rename from roles/logstash/molecule/pipelines/molecule.yml rename to molecule/logstash_pipelines/molecule.yml diff --git a/roles/logstash/molecule/pipelines/prepare.yml b/molecule/logstash_pipelines/prepare.yml similarity index 100% rename from roles/logstash/molecule/pipelines/prepare.yml rename to molecule/logstash_pipelines/prepare.yml diff --git a/roles/logstash/molecule/run_logstash/requirements.yml b/molecule/logstash_pipelines/requirements.yml similarity index 62% rename from roles/logstash/molecule/run_logstash/requirements.yml rename to molecule/logstash_pipelines/requirements.yml index 5d8c1146..a0014bbc 100644 --- a/roles/logstash/molecule/run_logstash/requirements.yml +++ b/molecule/logstash_pipelines/requirements.yml @@ -1,8 +1,5 @@ --- roles: - - name: elastic-repos - src: https://github.com/NETWAYS/ansible-role-elastic-repos - scm: git # Versions 1.7.0 and 1.8.0 seem to have a problem with idempotency - name: geerlingguy.redis version: "1.6.0" diff --git a/roles/logstash/molecule/pipelines/verify.yml b/molecule/logstash_pipelines/verify.yml similarity index 100% rename from roles/logstash/molecule/pipelines/verify.yml rename to molecule/logstash_pipelines/verify.yml diff --git a/roles/logstash/molecule/run_logstash/converge.yml b/molecule/logstash_run_logstash/converge.yml similarity index 86% rename from roles/logstash/molecule/run_logstash/converge.yml rename to molecule/logstash_run_logstash/converge.yml index 7f886f73..0dcb72ec 100644 --- a/roles/logstash/molecule/run_logstash/converge.yml +++ b/molecule/logstash_run_logstash/converge.yml @@ -6,6 +6,8 @@ # https://github.com/ansible-community/molecule/issues/1567#issuecomment-436876722 - name: Converge hosts: all + collections: + - NETWAYS.elasticstack vars: logstash_enable: true logstash_deactivate_log_to_syslog: false @@ -39,12 +41,12 @@ - name: forwarder key: forwarder tasks: - - name: "Include Elastics repos role" + - name: Include Elastics repos role include_role: - name: elastic-repos - - name: "Include Redis" + name: repos + - name: Include Redis include_role: name: geerlingguy.redis - - name: "Include Logstash" + - name: Include Logstash include_role: - name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}" + name: logstash diff --git a/roles/logstash/molecule/run_logstash/molecule.yml b/molecule/logstash_run_logstash/molecule.yml similarity index 100% rename from roles/logstash/molecule/run_logstash/molecule.yml rename to molecule/logstash_run_logstash/molecule.yml diff --git a/roles/logstash/molecule/run_logstash/prepare.yml b/molecule/logstash_run_logstash/prepare.yml similarity index 100% rename from roles/logstash/molecule/run_logstash/prepare.yml rename to molecule/logstash_run_logstash/prepare.yml diff --git a/roles/beats/molecule/full_stack/requirements.yml b/molecule/logstash_run_logstash/requirements.yml similarity index 62% rename from roles/beats/molecule/full_stack/requirements.yml rename to molecule/logstash_run_logstash/requirements.yml index 4d31d184..0002bca8 100644 --- a/roles/beats/molecule/full_stack/requirements.yml +++ b/molecule/logstash_run_logstash/requirements.yml @@ -2,3 +2,6 @@ roles: - name: geerlingguy.redis version: "1.6.0" + +collections: + - community.general diff --git a/roles/logstash/molecule/run_logstash/verify.yml b/molecule/logstash_run_logstash/verify.yml similarity index 100% rename from roles/logstash/molecule/run_logstash/verify.yml rename to molecule/logstash_run_logstash/verify.yml diff --git a/roles/logstash/molecule/specific_version/converge.yml b/molecule/logstash_specific_version/converge.yml similarity index 88% rename from roles/logstash/molecule/specific_version/converge.yml rename to molecule/logstash_specific_version/converge.yml index 953d695d..b4910eaf 100644 --- a/roles/logstash/molecule/specific_version/converge.yml +++ b/molecule/logstash_specific_version/converge.yml @@ -5,6 +5,8 @@ # https://github.com/ansible-community/molecule/issues/1567#issuecomment-436876722 - name: Converge hosts: all + collections: + - NETWAYS.elasticstack vars: logstash_manage_logging: true logstash_logging_console: false @@ -24,8 +26,8 @@ - name: "Include Elastics repos role" include_role: - name: elastic-repos + name: repos - name: "Include Logstash" include_role: - name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}" + name: logstash diff --git a/roles/logstash/molecule/specific_version/molecule.yml b/molecule/logstash_specific_version/molecule.yml similarity index 100% rename from roles/logstash/molecule/specific_version/molecule.yml rename to molecule/logstash_specific_version/molecule.yml diff --git a/roles/logstash/molecule/specific_version/prepare.yml b/molecule/logstash_specific_version/prepare.yml similarity index 100% rename from roles/logstash/molecule/specific_version/prepare.yml rename to molecule/logstash_specific_version/prepare.yml diff --git a/molecule/logstash_specific_version/requirements.yml b/molecule/logstash_specific_version/requirements.yml new file mode 100644 index 00000000..a0014bbc --- /dev/null +++ b/molecule/logstash_specific_version/requirements.yml @@ -0,0 +1,8 @@ +--- +roles: + # Versions 1.7.0 and 1.8.0 seem to have a problem with idempotency + - name: geerlingguy.redis + version: "1.6.0" + +collections: + - community.general diff --git a/roles/logstash/molecule/specific_version/verify.yml b/molecule/logstash_specific_version/verify.yml similarity index 100% rename from roles/logstash/molecule/specific_version/verify.yml rename to molecule/logstash_specific_version/verify.yml diff --git a/molecule/repos_default/converge.yml b/molecule/repos_default/converge.yml new file mode 100644 index 00000000..12597e29 --- /dev/null +++ b/molecule/repos_default/converge.yml @@ -0,0 +1,11 @@ +--- +- name: Converge + hosts: all + collections: + - NETWAYS.elasticstack + vars: + elastic_rpm_workaround: true + tasks: + - name: Include Elastic Repos + ansible.builtin.include_role: + name: repos diff --git a/roles/repos/molecule/elastic8/molecule.yml b/molecule/repos_default/molecule.yml similarity index 78% rename from roles/repos/molecule/elastic8/molecule.yml rename to molecule/repos_default/molecule.yml index 6b7f99cd..dbbe9ea0 100644 --- a/roles/repos/molecule/elastic8/molecule.yml +++ b/molecule/repos_default/molecule.yml @@ -8,14 +8,11 @@ platforms: image: "geerlingguy/docker-${MOLECULE_DISTRO:-centos7}-ansible:latest" command: ${MOLECULE_DOCKER_COMMAND:-""} volumes: - - /sys/fs/cgroup:/sys/fs/cgroup:ro + - /sys/fs/cgroup:/sys/fs/cgroup:rw + cgroupns_mode: host privileged: true pre_build_image: true provisioner: name: ansible verifier: name: ansible -lint: | - set -e - yamllint . - ansible-lint . diff --git a/roles/repos/molecule/default/prepare.yml b/molecule/repos_default/prepare.yml similarity index 100% rename from roles/repos/molecule/default/prepare.yml rename to molecule/repos_default/prepare.yml diff --git a/roles/repos/molecule/default/verify.yml b/molecule/repos_default/verify.yml similarity index 100% rename from roles/repos/molecule/default/verify.yml rename to molecule/repos_default/verify.yml diff --git a/roles/repos/molecule/elastic8/converge.yml b/molecule/repos_elastic8/converge.yml similarity index 83% rename from roles/repos/molecule/elastic8/converge.yml rename to molecule/repos_elastic8/converge.yml index 03eca761..6c71e2b2 100644 --- a/roles/repos/molecule/elastic8/converge.yml +++ b/molecule/repos_elastic8/converge.yml @@ -2,6 +2,8 @@ # The workaround for arbitrarily named role directory is important because the git repo has one name and the role within it another # Found at: https://github.com/ansible-community/molecule/issues/1567#issuecomment-436876722 - name: Converge + collections: + - NETWAYS.elasticstack vars: elastic_release: 8 elastic_rpm_workaround: true @@ -9,4 +11,4 @@ tasks: - name: "Include Elastic Repos" ansible.builtin.include_role: - name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}" + name: repos diff --git a/roles/repos/molecule/default/molecule.yml b/molecule/repos_elastic8/molecule.yml similarity index 78% rename from roles/repos/molecule/default/molecule.yml rename to molecule/repos_elastic8/molecule.yml index 6b7f99cd..dbbe9ea0 100644 --- a/roles/repos/molecule/default/molecule.yml +++ b/molecule/repos_elastic8/molecule.yml @@ -8,14 +8,11 @@ platforms: image: "geerlingguy/docker-${MOLECULE_DISTRO:-centos7}-ansible:latest" command: ${MOLECULE_DOCKER_COMMAND:-""} volumes: - - /sys/fs/cgroup:/sys/fs/cgroup:ro + - /sys/fs/cgroup:/sys/fs/cgroup:rw + cgroupns_mode: host privileged: true pre_build_image: true provisioner: name: ansible verifier: name: ansible -lint: | - set -e - yamllint . - ansible-lint . diff --git a/roles/repos/molecule/elastic8/prepare.yml b/molecule/repos_elastic8/prepare.yml similarity index 100% rename from roles/repos/molecule/elastic8/prepare.yml rename to molecule/repos_elastic8/prepare.yml diff --git a/roles/repos/molecule/elastic8/verify.yml b/molecule/repos_elastic8/verify.yml similarity index 100% rename from roles/repos/molecule/elastic8/verify.yml rename to molecule/repos_elastic8/verify.yml diff --git a/roles/repos/molecule/oss/converge.yml b/molecule/repos_oss/converge.yml similarity index 84% rename from roles/repos/molecule/oss/converge.yml rename to molecule/repos_oss/converge.yml index 5239f868..c98cf928 100644 --- a/roles/repos/molecule/oss/converge.yml +++ b/molecule/repos_oss/converge.yml @@ -3,10 +3,12 @@ # Found at: https://github.com/ansible-community/molecule/issues/1567#issuecomment-436876722 - name: Converge hosts: all + collections: + - NETWAYS.elasticstack vars: elastic_variant: oss elastic_rpm_workaround: true tasks: - name: "Include Elastic Repos" ansible.builtin.include_role: - name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}" + name: repos diff --git a/roles/repos/molecule/oss/molecule.yml b/molecule/repos_oss/molecule.yml similarity index 79% rename from roles/repos/molecule/oss/molecule.yml rename to molecule/repos_oss/molecule.yml index 9e030476..a083fcd5 100644 --- a/roles/repos/molecule/oss/molecule.yml +++ b/molecule/repos_oss/molecule.yml @@ -8,14 +8,11 @@ platforms: image: "geerlingguy/docker-${MOLECULE_DISTRO:-centos7}-ansible:latest" command: ${MOLECULE_DOCKER_COMMAND:-""} volumes: - - /sys/fs/cgroup:/sys/fs/cgroup:ro + - /sys/fs/cgroup:/sys/fs/cgroup:rw + cgroupns_mode: host privileged: true pre_build_image: true provisioner: name: ansible verifier: name: ansible -lint: | - set -e - yamllint . - ansible-lint . diff --git a/roles/repos/molecule/oss/prepare.yml b/molecule/repos_oss/prepare.yml similarity index 100% rename from roles/repos/molecule/oss/prepare.yml rename to molecule/repos_oss/prepare.yml diff --git a/roles/repos/molecule/oss/verify.yml b/molecule/repos_oss/verify.yml similarity index 100% rename from roles/repos/molecule/oss/verify.yml rename to molecule/repos_oss/verify.yml diff --git a/roles/beats/tests/inventory b/roles/beats/tests/inventory deleted file mode 100644 index 878877b0..00000000 --- a/roles/beats/tests/inventory +++ /dev/null @@ -1,2 +0,0 @@ -localhost - diff --git a/roles/beats/tests/test.yml b/roles/beats/tests/test.yml deleted file mode 100644 index b9b9672b..00000000 --- a/roles/beats/tests/test.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -- hosts: localhost - remote_user: root - roles: - - beats diff --git a/roles/elasticsearch/tasks/elasticsearch-security.yml b/roles/elasticsearch/tasks/elasticsearch-security.yml index c56764a6..7ef982d6 100644 --- a/roles/elasticsearch/tasks/elasticsearch-security.yml +++ b/roles/elasticsearch/tasks/elasticsearch-security.yml @@ -45,7 +45,7 @@ when: - "'xpack.security.http.ssl.keystore.secure_password' in es_keystore.stdout_lines" - elasticsearch_http_security - register: http_ssl_keystore_secure_password + register: http_ssl_keystore_secure_password ignore_errors: "{{ ansible_check_mode }}" changed_when: false diff --git a/roles/kibana/.github/workflows/molecule.yml b/roles/kibana/.github/workflows/molecule.yml deleted file mode 100644 index bfc61691..00000000 --- a/roles/kibana/.github/workflows/molecule.yml +++ /dev/null @@ -1,39 +0,0 @@ ---- -name: Molecule Test -on: - push: - tags: - - v* - branches: - - master - pull_request: - -jobs: - build: - runs-on: ubuntu-latest - - strategy: - max-parallel: 3 - matrix: - distro: [centos7] - scenario: [default, full_stack, full_stack-oss] - - steps: - - name: Check out code - uses: actions/checkout@v2 - - - name: Set up Python 3.8 - uses: actions/setup-python@v2 - with: - python-version: 3.8 - - - name: Install dependencies - run: | - python3 -m pip install --upgrade pip - python3 -m pip install -r requirements-test.txt - - - name: Test with molecule - run: | - molecule test -s ${{ matrix.scenario }} - env: - MOLECULE_DISTRO: ${{ matrix.distro }} diff --git a/roles/kibana/meta/main.yml b/roles/kibana/meta/main.yml index d51815e1..bb6fdbba 100644 --- a/roles/kibana/meta/main.yml +++ b/roles/kibana/meta/main.yml @@ -3,31 +3,9 @@ galaxy_info: author: netways description: Ansible role for Kibana company: Netways GmbH - - # If the issue tracker for your role is not on github, uncomment the - # next line and provide a value - # issue_tracker_url: http://example.com/issue/tracker - - # Choose a valid license ID from https://spdx.org - some suggested licenses: - # - BSD-3-Clause (default) - # - MIT - # - GPL-2.0-or-later - # - GPL-3.0-only - # - Apache-2.0 - # - CC-BY-4.0 license: GPL-3.0-or-later - min_ansible_version: 2.4 - - # If this a Container Enabled role, provide the minimum Ansible Container version. - # min_ansible_container_version: - - # - # Provide a list of supported platforms, and for each platform a list of versions. - # If you don't wish to enumerate all versions for a particular platform, use 'all'. - # To view available platforms and versions (or releases), visit: - # https://galaxy.ansible.com/api/v1/platforms/ - # + min_ansible_version: "2.4" platforms: - name: CentOS versions: @@ -37,13 +15,6 @@ galaxy_info: - 10 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/kibana/molecule/default/INSTALL.rst b/roles/kibana/molecule/default/INSTALL.rst deleted file mode 100644 index 6a44bde9..00000000 --- a/roles/kibana/molecule/default/INSTALL.rst +++ /dev/null @@ -1,22 +0,0 @@ -******* -Docker driver installation guide -******* - -Requirements -============ - -* Docker Engine - -Install -======= - -Please refer to the `Virtual environment`_ documentation for installation best -practices. If not using a virtual environment, please consider passing the -widely recommended `'--user' flag`_ when invoking ``pip``. - -.. _Virtual environment: https://virtualenv.pypa.io/en/latest/ -.. _'--user' flag: https://packaging.python.org/tutorials/installing-packages/#installing-to-the-user-site - -.. code-block:: bash - - $ pip install 'molecule[docker]' diff --git a/roles/kibana/molecule/default/requirements.yml b/roles/kibana/molecule/default/requirements.yml deleted file mode 100644 index 05c6f2aa..00000000 --- a/roles/kibana/molecule/default/requirements.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- -- name: elastic-repos - src: https://github.com/widhalmt/ansible-role-elastic-repos.git - scm: git diff --git a/roles/kibana/tests/inventory b/roles/kibana/tests/inventory deleted file mode 100644 index 878877b0..00000000 --- a/roles/kibana/tests/inventory +++ /dev/null @@ -1,2 +0,0 @@ -localhost - diff --git a/roles/kibana/tests/test.yml b/roles/kibana/tests/test.yml deleted file mode 100644 index 5ed0a818..00000000 --- a/roles/kibana/tests/test.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -- hosts: localhost - remote_user: root - roles: - - kibana diff --git a/roles/logstash/molecule/default/requirements.yml b/roles/logstash/molecule/default/requirements.yml deleted file mode 100644 index dd080349..00000000 --- a/roles/logstash/molecule/default/requirements.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -roles: - - name: elastic-repos - src: https://github.com/NETWAYS/ansible-role-elastic-repos - scm: git - -collections: - - community.general diff --git a/roles/logstash/molecule/default/verify.yml b/roles/logstash/molecule/default/verify.yml deleted file mode 100644 index a82dd6fd..00000000 --- a/roles/logstash/molecule/default/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/roles/logstash/molecule/full_stack-oss/requirements.yml b/roles/logstash/molecule/full_stack-oss/requirements.yml deleted file mode 100644 index f16b9b49..00000000 --- a/roles/logstash/molecule/full_stack-oss/requirements.yml +++ /dev/null @@ -1,17 +0,0 @@ ---- -roles: - - name: elastic-repos - src: https://github.com/NETWAYS/ansible-role-elastic-repos - scm: git - - name: elasticsearch - src: https://github.com/NETWAYS/ansible-role-elasticsearch.git - scm: git - - name: beats - src: https://github.com/NETWAYS/ansible-role-beats.git - scm: git - # Versions 1.7.0 and 1.8.0 seem to have a problem with idempotency - - name: geerlingguy.redis - version: "1.6.0" - -collections: - - community.general diff --git a/roles/logstash/molecule/full_stack/requirements.yml b/roles/logstash/molecule/full_stack/requirements.yml deleted file mode 100644 index f16b9b49..00000000 --- a/roles/logstash/molecule/full_stack/requirements.yml +++ /dev/null @@ -1,17 +0,0 @@ ---- -roles: - - name: elastic-repos - src: https://github.com/NETWAYS/ansible-role-elastic-repos - scm: git - - name: elasticsearch - src: https://github.com/NETWAYS/ansible-role-elasticsearch.git - scm: git - - name: beats - src: https://github.com/NETWAYS/ansible-role-beats.git - scm: git - # Versions 1.7.0 and 1.8.0 seem to have a problem with idempotency - - name: geerlingguy.redis - version: "1.6.0" - -collections: - - community.general diff --git a/roles/logstash/molecule/pipelines/INSTALL.rst b/roles/logstash/molecule/pipelines/INSTALL.rst deleted file mode 100644 index 6a44bde9..00000000 --- a/roles/logstash/molecule/pipelines/INSTALL.rst +++ /dev/null @@ -1,22 +0,0 @@ -******* -Docker driver installation guide -******* - -Requirements -============ - -* Docker Engine - -Install -======= - -Please refer to the `Virtual environment`_ documentation for installation best -practices. If not using a virtual environment, please consider passing the -widely recommended `'--user' flag`_ when invoking ``pip``. - -.. _Virtual environment: https://virtualenv.pypa.io/en/latest/ -.. _'--user' flag: https://packaging.python.org/tutorials/installing-packages/#installing-to-the-user-site - -.. code-block:: bash - - $ pip install 'molecule[docker]' diff --git a/roles/logstash/tests/inventory b/roles/logstash/tests/inventory deleted file mode 100644 index 878877b0..00000000 --- a/roles/logstash/tests/inventory +++ /dev/null @@ -1,2 +0,0 @@ -localhost - diff --git a/roles/logstash/tests/test.yml b/roles/logstash/tests/test.yml deleted file mode 100644 index 1a125ce6..00000000 --- a/roles/logstash/tests/test.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -- hosts: localhost - remote_user: root - roles: - - logstash diff --git a/roles/repos/.github/workflows/molecule.yml b/roles/repos/.github/workflows/molecule.yml deleted file mode 100644 index f1053ef1..00000000 --- a/roles/repos/.github/workflows/molecule.yml +++ /dev/null @@ -1,41 +0,0 @@ ---- -name: CI -on: - push: - tags: - - v* - branches: - - main - pull_request: - -jobs: - build: - runs-on: ubuntu-latest - - strategy: - max-parallel: 4 - matrix: - - distro: [centos7, debian10, debian11, rockylinux8, rockylinux9, ubuntu2004, ubuntu2204] - scenario: [default, oss, elastic8] - - steps: - - name: Check out code - uses: actions/checkout@v2 - - - name: Set up Python 3.8 - uses: actions/setup-python@v2 - with: - python-version: 3.8 - - - name: Install dependencies - run: | - python3 -m pip install --upgrade pip - python3 -m pip install -r requirements-test.txt - ansible-galaxy collection install community.general - - - name: Test with molecule - run: | - molecule test -s ${{ matrix.scenario }} - env: - MOLECULE_DISTRO: ${{ matrix.distro }} diff --git a/roles/repos/handlers/main.yml b/roles/repos/handlers/main.yml index 4f2ac579..ed97d539 100644 --- a/roles/repos/handlers/main.yml +++ b/roles/repos/handlers/main.yml @@ -1,2 +1 @@ --- -# handlers file for elastic-repos \ No newline at end of file diff --git a/roles/repos/molecule/default/INSTALL.rst b/roles/repos/molecule/default/INSTALL.rst deleted file mode 100644 index d926ca25..00000000 --- a/roles/repos/molecule/default/INSTALL.rst +++ /dev/null @@ -1,22 +0,0 @@ -******* -Docker driver installation guide -******* - -Requirements -============ - -* Docker Engine - -Install -======= - -Please refer to the `Virtual environment`_ documentation for installation best -practices. If not using a virtual environment, please consider passing the -widely recommended `'--user' flag`_ when invoking ``pip``. - -.. _Virtual environment: https://virtualenv.pypa.io/en/latest/ -.. _'--user' flag: https://packaging.python.org/tutorials/installing-packages/#installing-to-the-user-site - -.. code-block:: bash - - $ python3 -m pip install 'molecule[docker]' diff --git a/roles/repos/molecule/default/converge.yml b/roles/repos/molecule/default/converge.yml deleted file mode 100644 index 8e548d83..00000000 --- a/roles/repos/molecule/default/converge.yml +++ /dev/null @@ -1,11 +0,0 @@ ---- -# The workaround for arbitrarily named role directory is important because the git repo has one name and the role within it another -# Found at: https://github.com/ansible-community/molecule/issues/1567#issuecomment-436876722 -- name: Converge - hosts: all - vars: - elastic_rpm_workaround: true - tasks: - - name: "Include Elastic Repos" - ansible.builtin.include_role: - name: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}" diff --git a/roles/repos/molecule/elastic8/INSTALL.rst b/roles/repos/molecule/elastic8/INSTALL.rst deleted file mode 100644 index d926ca25..00000000 --- a/roles/repos/molecule/elastic8/INSTALL.rst +++ /dev/null @@ -1,22 +0,0 @@ -******* -Docker driver installation guide -******* - -Requirements -============ - -* Docker Engine - -Install -======= - -Please refer to the `Virtual environment`_ documentation for installation best -practices. If not using a virtual environment, please consider passing the -widely recommended `'--user' flag`_ when invoking ``pip``. - -.. _Virtual environment: https://virtualenv.pypa.io/en/latest/ -.. _'--user' flag: https://packaging.python.org/tutorials/installing-packages/#installing-to-the-user-site - -.. code-block:: bash - - $ python3 -m pip install 'molecule[docker]' diff --git a/roles/repos/molecule/oss/INSTALL.rst b/roles/repos/molecule/oss/INSTALL.rst deleted file mode 100644 index d926ca25..00000000 --- a/roles/repos/molecule/oss/INSTALL.rst +++ /dev/null @@ -1,22 +0,0 @@ -******* -Docker driver installation guide -******* - -Requirements -============ - -* Docker Engine - -Install -======= - -Please refer to the `Virtual environment`_ documentation for installation best -practices. If not using a virtual environment, please consider passing the -widely recommended `'--user' flag`_ when invoking ``pip``. - -.. _Virtual environment: https://virtualenv.pypa.io/en/latest/ -.. _'--user' flag: https://packaging.python.org/tutorials/installing-packages/#installing-to-the-user-site - -.. code-block:: bash - - $ python3 -m pip install 'molecule[docker]' diff --git a/roles/repos/tests/inventory b/roles/repos/tests/inventory deleted file mode 100644 index 878877b0..00000000 --- a/roles/repos/tests/inventory +++ /dev/null @@ -1,2 +0,0 @@ -localhost - diff --git a/roles/repos/tests/test.yml b/roles/repos/tests/test.yml deleted file mode 100644 index a45b587d..00000000 --- a/roles/repos/tests/test.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -- hosts: localhost - remote_user: root - roles: - - elastic-repos \ No newline at end of file diff --git a/roles/repos/vars/main.yml b/roles/repos/vars/main.yml index e3c0fb6f..ed97d539 100644 --- a/roles/repos/vars/main.yml +++ b/roles/repos/vars/main.yml @@ -1,2 +1 @@ --- -# vars file for elastic-repos \ No newline at end of file