github-action-playbook.yml 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. ---
  2. # Setup joystream code, build and Create AMI
  3. - name: Setup instance
  4. hosts: all
  5. tasks:
  6. - block:
  7. - name: Get code from git repo
  8. include_role:
  9. name: common
  10. tasks_from: get-code-git
  11. - name: Run setup and build
  12. include_role:
  13. name: common
  14. tasks_from: run-setup-build
  15. - name: Install subkey
  16. include_role:
  17. name: admin
  18. tasks_from: main
  19. - name: Basic AMI Creation
  20. amazon.aws.ec2_ami:
  21. instance_id: "{{ instance_id }}"
  22. wait: yes
  23. name: "{{ ami_name }}"
  24. launch_permissions:
  25. group_names: ['all']
  26. tags:
  27. Name: "{{ ami_name }}"
  28. register: ami_data
  29. delegate_to: localhost
  30. - name: Print AMI ID
  31. debug:
  32. msg: "AMI ID is: {{ ami_data.image_id }}"
  33. always:
  34. - name: Delete the stack
  35. amazon.aws.cloudformation:
  36. stack_name: "{{ stack_name }}"
  37. state: "absent"
  38. delegate_to: localhost