diff --git a/tasks/main.yml b/tasks/main.yml index bab9fff..e938824 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,22 +1,15 @@ --- -- name: Copy Package to host +- name: copy binaries copy: - src: files/{{ item }} - dest: "/opt/ansiblepackages/{{ item }}" + src: "{{ item.src }}" + dest: "{{ item.dst }}" owner: root group: root - mode: '0600' + mode: '0755' backup: yes with_items: - - step-cli_0.15.16_amd64.deb - - step-ca_0.15.15_amd64.deb - -- name: install package - apt: - deb: "/opt/ansiblepackages/{{ item }}" - with_items: - - step-cli_0.15.16_amd64.deb - - step-ca_0.15.15_amd64.deb + - { src: "files/step/step_0.15.16/{{ ansible_architecture }}/bin/step", dst: "/bin/step" } + - { src: "files/step-ca/step-ca_0.15.15/{{ ansible_architecture }}/bin/step-ca", dst: "/bin/step-ca" } - name: create user for step-ca user: @@ -42,7 +35,7 @@ dest: ~/.step - name: init step-ca - command: step ca init --name="{{ pki_name }}" --dns {{ ansible_hostname }} --issuer="{{ pki_name }}" --address=:4343 --provisioner="{{ pki_name }}" --password-file=/etc/step-ca/password.txt --provisioner-password-file=/etc/step-ca/password.txt + command: step ca init -ssh --name="{{ pki_name }}" --dns {{ ansible_hostname }} --issuer="{{ pki_name }}" --address=:4343 --provisioner="{{ pki_name }}" --password-file=/etc/step-ca/password.txt --provisioner-password-file=/etc/step-ca/password.txt args: creates: /etc/step-ca/config @@ -95,18 +88,32 @@ - name: Flush handlers meta: flush_handlers -- name: list provisioners - command: step ca provisioner list - register: povisionerlist +- name: check for acme privisioner + lineinfile: + path: /etc/step-ca/config/ca.json + regexp: '.*"type": "ACME",.*' + line: "{{'\t'}}{{'\t'}}{{'\t'}}{{'\t'}}\"type\": \"ACME\"," + state: present + check_mode: yes + register: acmepresent - name: add acme provisioner command: step ca provisioner add acme --type ACME - when: not povisionerlist.stdout.find ("ACME") != -1 + when: acmepresent is changed notify: - restart step-ca +- name: check for default JWK privisioner + lineinfile: + path: /etc/step-ca/config/ca.json + regexp: '.*"type": "JWK",.*' + line: "{{'\t'}}{{'\t'}}{{'\t'}}{{'\t'}}\"type\": \"JWK\"," + state: present + check_mode: yes + register: jwkpresent + - name: remove jwk provisioner command: step ca provisioner remove "{{ pki_name }}" --type JWK - when: povisionerlist.stdout.find ("JWK") != -1 + when: jwkpresent is not changed notify: - - restart step-ca + - restart step-ca \ No newline at end of file