|
| 1 | +--- |
| 2 | +# The workaround for arbitrarily named role directory is important because the git repo has one name and the role within it another |
| 3 | +# Found at: https://github.com/ansible-community/molecule/issues/1567#issuecomment-436876722 |
| 4 | +- name: Converge |
| 5 | + collections: |
| 6 | + - netways.elasticstack |
| 7 | + hosts: all |
| 8 | + vars: |
| 9 | + elasticstack_full_stack: false |
| 10 | + elasticsearch_jna_workaround: true |
| 11 | + elasticsearch_disable_systemcallfilterchecks: true |
| 12 | + #elasticstack_release: "{{ lookup('env', 'ELASTIC_RELEASE') | int}}" |
| 13 | + elasticstack_release: 8 |
| 14 | + elasticsearch_heap: "1" |
| 15 | + elasticstack_no_log: false |
| 16 | + tasks: |
| 17 | + - name: Include Elastics repos role |
| 18 | + ansible.builtin.include_role: |
| 19 | + name: repos |
| 20 | + - name: Include Elasticsearch |
| 21 | + ansible.builtin.include_role: |
| 22 | + name: elasticsearch |
| 23 | + |
| 24 | + - name: Fetch Elastic password # noqa: risky-shell-pipe |
| 25 | + ansible.builtin.shell: > |
| 26 | + if test -n "$(ps -p $$ | grep bash)"; then set -o pipefail; fi; |
| 27 | + grep "PASSWORD elastic" /usr/share/elasticsearch/initial_passwords | |
| 28 | + awk {' print $4 '} |
| 29 | + register: elasticstack_password |
| 30 | + changed_when: false |
| 31 | + |
| 32 | + - name: Create elasticsearch role 'new-role' |
| 33 | + netways.elasticstack.elasticsearch_role: |
| 34 | + name: new-role1 |
| 35 | + cluster: |
| 36 | + - manage_own_api_key |
| 37 | + - delegate_pki |
| 38 | + indicies: |
| 39 | + - names: |
| 40 | + - foobar321 |
| 41 | + privileges: |
| 42 | + - read |
| 43 | + - write |
| 44 | + state: present |
| 45 | + host: https://localhost:9200 |
| 46 | + auth_user: elastic |
| 47 | + auth_pass: "{{ elasticstack_password.stdout }}" |
| 48 | + verify_certs: false |
| 49 | + |
| 50 | + - name: Create elasticsearch user 'new-user' |
| 51 | + netways.elasticstack.elasticsearch_user: |
| 52 | + name: new-user1 |
| 53 | + fullname: New User |
| 54 | + password: changeMe123! |
| 55 | + |
| 56 | + roles: |
| 57 | + - new-role1 |
| 58 | + - logstash-writer |
| 59 | + enabled: true |
| 60 | + state: present |
| 61 | + host: https://localhost:9200 |
| 62 | + auth_user: elastic |
| 63 | + auth_pass: "{{ elasticstack_password.stdout }}" |
| 64 | + verify_certs: false |
| 65 | + ca_certs: /etc/elasticsearch/certs/http_ca.crt |
0 commit comments