github-action-playbook.yml 948 B

12345678910111213141516171819202122232425262728293031323334353637383940
  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: Basic AMI Creation
  16. amazon.aws.ec2_ami:
  17. instance_id: "{{ instance_id }}"
  18. wait: yes
  19. name: "{{ ami_name }}"
  20. launch_permissions:
  21. group_names: ['all']
  22. tags:
  23. Name: "{{ ami_name }}"
  24. register: ami_data
  25. delegate_to: localhost
  26. - name: Print AMI ID
  27. debug:
  28. msg: "AMI ID is: {{ ami_data.image_id }}"
  29. always:
  30. - name: Delete the stack
  31. amazon.aws.cloudformation:
  32. stack_name: "{{ stack_name }}"
  33. state: "absent"
  34. delegate_to: localhost