You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

39 lines
1002 B

  1. ---
  2. - hosts: localhost
  3. connection: local
  4. gather_facts: False
  5. vars_prompt:
  6. - name: AWS_PROFILE
  7. prompt: AWS Profile?
  8. private: no
  9. default: test
  10. - name: MASTER_PASSWORD
  11. prompt: master password?
  12. private: yes
  13. - name: LESSPASS_PROFILE_FILE
  14. prompt: Lesspass Profile
  15. private: no
  16. default: aws.prod.json
  17. vars:
  18. lesspass_profile: "{{ lookup('file', '/home/m/git/passwords/' + LESSPASS_PROFILE_FILE ) | from_json}}"
  19. tasks:
  20. - name: Get the current caller identity facts
  21. aws_caller_info:
  22. profile: "{{ AWS_PROFILE }}"
  23. register: caller_facts
  24. - name: calculate password
  25. set_fact:
  26. password: "{{ lookup('lesspass', MASTER_PASSWORD, profile='/home/m/git/passwords/' + LESSPASS_PROFILE_FILE ) }}"
  27. - name: update iam password
  28. iam:
  29. iam_type: user
  30. profile: "{{ AWS_PROFILE }}"
  31. name: "{{ lesspass_profile.login }}"
  32. state: present
  33. password: "{{ password }}"