diff --git a/.gitignore b/.gitignore index 1377554..951f5c4 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ *.swp +secure.yml diff --git a/README.md b/README.md index e769c2f..fb2f099 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,7 @@ This script loads input from: - molecule/default/playbook.yml* - molecule/default/verify.yml - generate_modules.sh +- secure.yml - Ansible Galaxy (Items with a star are mandatory) @@ -69,6 +70,15 @@ author: Robert de Bock (robert@meinit.nl) author_website: "https://robertdebock.nl/" ``` +## secure.yml + +This file contains a secret unique to you; te slack encryption token. You have to create this file yourself and it should contain: + +```yaml +--- +slack_token: "YOUR_SLACK_USERNAME:YOUR_SLACK_TOKEN" +``` + ## meta/version.yml This optional file can be placed when a role contains a version. diff --git a/ansible.cfg b/ansible.cfg new file mode 100644 index 0000000..d8fe66c --- /dev/null +++ b/ansible.cfg @@ -0,0 +1,2 @@ +[defaults] +vault_password_file=vault_password_file.txt diff --git a/generate.yml b/generate.yml index ec2ec3f..d4fe867 100755 --- a/generate.yml +++ b/generate.yml @@ -125,6 +125,26 @@ file: "{{ role_path }}/.travis.yml" name: travis + - name: load secure.yml + include_vars: + file: secure.yml + name: secure + + - name: generate secure hash + command: /usr/bin/travis encrypt --pro {{ secure.slack_token }} --no-interactive + register: travis_secure + when: + - travis.notifications.slack.secure | length < 512 + + - name: overwrite travis.notifications.slack.secure + set_fact: + travis: + notifications: + slack: + secure: "{{ travis_secure.stdout }}" + when: + travis_secure.stdout is defined + - name: create .github directory file: path: "{{ role_path }}/.github" diff --git a/templates/travis.yml.j2 b/templates/travis.yml.j2 index 541a25b..c498a11 100644 --- a/templates/travis.yml.j2 +++ b/templates/travis.yml.j2 @@ -37,5 +37,5 @@ script: notifications: webhooks: https://galaxy.ansible.com/api/v1/notifications/ slack: - secure: "{{ travis.notifications.slack.secure }}" + secure: {{ travis.notifications.slack.secure }} email: false