Difference between revisions of "Ansible: create Amazon ec2 instance"

From wikieduonline
Jump to navigation Jump to search
Tags: Mobile web edit, Mobile edit
Tags: Mobile web edit, Mobile edit
Line 3: Line 3:
 
#!/usr/bin/env ansible-playbook  
 
#!/usr/bin/env ansible-playbook  
  
- amazon.aws.ec2:
+
- hosts: localhost
    key_name: mykey
+
  become: yes
    instance_type: t2.micro
+
 
    image: ami-123456
+
  tasks:
    wait: yes
+
    - amazon.aws.ec2:
    group: webserver
+
      key_name: mykey
    count: 3
+
      instance_type: t2.micro
    vpc_subnet_id: subnet-29e63245
+
      image: ami-123456
    assign_public_ip: yes
+
      wait: yes
 +
      group: webserver
 +
      count: 3
 +
      vpc_subnet_id: subnet-29e63245
 +
      assign_public_ip: yes
 
</pre>
 
</pre>
  

Revision as of 13:53, 12 April 2021


#!/usr/bin/env ansible-playbook 

- hosts: localhost
  become: yes

  tasks:
    - amazon.aws.ec2:
       key_name: mykey
       instance_type: t2.micro
       image: ami-123456
       wait: yes
       group: webserver
       count: 3
       vpc_subnet_id: subnet-29e63245
       assign_public_ip: yes


Related terms


See also

Advertising: