Guest User

Untitled

a guest
Feb 12th, 2019
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.52 KB | None | 0 0
  1. -
  2. name: Create accounts.
  3. hosts: localhost
  4.  
  5. vars_prompt:
  6. - name: "tag_start"
  7. prompt: "Please set the starting number for the account"
  8. private: no
  9.  
  10. - name: "tag_end"
  11. prompt: "Please set the ending number for the account"
  12. private: no
  13.  
  14. tasks:
  15. - name: "Emails"
  16. debug:
  17. msg: "test+{{item}}@gmail.com"
  18. with_sequence: start={{ tag_start }} end={{ tag_end }}
  19. register: email
  20.  
  21. - name: "Account name"
  22. debug:
  23. msg: "account{{item}}"
  24. with_sequence: start={{ tag_start }} end={{ tag_end }}
  25. register: account_name
  26.  
  27. - name: "Emails list"
  28. debug:
  29. msg: "{{email}}"
  30.  
  31. - name: "Account names"
  32. debug:
  33. msg: "{{account_name}}"
  34.  
  35. - name: Create AWS account
  36. shell: >
  37. aws organizations create-account --email "{{ item[0] }}"
  38. --account-name "{{ item[1] }}"
  39. --role-name admin
  40. --iam-user-access-to-billing ALLOW
  41. --profile default
  42. with_together:
  43. - "{{ email }}"
  44. - "{{ account_name }}"
  45.  
  46. TASK [Emails] ********************************************************************************************************************************************************************************************************************************************************************************************************
  47. task path: /Users/me/repos/create_aws_account.yaml:15
  48. ok: [localhost] => (item=46) => {
  49. "msg": "test+46@gmail.com"
  50. }
  51. ok: [localhost] => (item=47) => {
  52. "msg": "test+47@gmail.com"
  53. }
  54.  
  55. TASK [Account name] **************************************************************************************************************************************************************************************************************************************************************************************************
  56. task path: /Users/me/create_aws_account.yaml:21
  57. ok: [localhost] => (item=46) => {
  58. "msg": "account46"
  59. }
  60. ok: [localhost] => (item=47) => {
  61. "msg": "account47"
  62. }
  63.  
  64. TASK [Emails] ********************************************************************************************************************************************************************************************************************************************************************************************************
  65. task path: /Users/me/create_aws_account.yaml:27
  66. ok: [localhost] => {
  67. "msg": {
  68. "changed": false,
  69. "msg": "All items completed",
  70. "results": [
  71. {
  72. "_ansible_ignore_errors": null,
  73. "_ansible_item_label": "46",
  74. "_ansible_item_result": true,
  75. "_ansible_no_log": false,
  76. "_ansible_verbose_always": true,
  77. "changed": false,
  78. "failed": false,
  79. "item": "46",
  80. "msg": "test+46@gmail.com"
  81. },
  82. {
  83. "_ansible_ignore_errors": null,
  84. "_ansible_item_label": "47",
  85. "_ansible_item_result": true,
  86. "_ansible_no_log": false,
  87. "_ansible_verbose_always": true,
  88. "changed": false,
  89. "failed": false,
  90. "item": "47",
  91. "msg": "test+47@gmail.com"
  92. }
  93. ]
  94. }
  95. }
  96.  
  97. TASK [Account names] *************************************************************************************************************************************************************************************************************************************************************************************************
  98. task path: /Users/me/create_aws_account.yaml:31
  99. ok: [localhost] => {
  100. "msg": {
  101. "changed": false,
  102. "msg": "All items completed",
  103. "results": [
  104. {
  105. "_ansible_ignore_errors": null,
  106. "_ansible_item_label": "46",
  107. "_ansible_item_result": true,
  108. "_ansible_no_log": false,
  109. "_ansible_verbose_always": true,
  110. "changed": false,
  111. "failed": false,
  112. "item": "46",
  113. "msg": "account46"
  114. },
  115. {
  116. "_ansible_ignore_errors": null,
  117. "_ansible_item_label": "47",
  118. "_ansible_item_result": true,
  119. "_ansible_no_log": false,
  120. "_ansible_verbose_always": true,
  121. "changed": false,
  122. "failed": false,
  123. "item": "47",
  124. "msg": "account47"
  125. }
  126. ]
  127. }
  128. }
Add Comment
Please, Sign In to add comment