【发布时间】:2021-10-16 20:38:34
【问题描述】:
我已经创建了一个用于创建 Ec2 实例并安装 python 以通过 ssh 连接服务器的 ansible playbook。
Playbook 成功创建了一个 EC2 实例,但它没有在新创建的 Ec2 实例上安装 python,而是在我的主计算机上安装了 python。
谁能帮我解决这个问题。
我的代码:
- hosts: localhost
remote_user: ubuntu
become: yes
tasks:
- name: I'm going to create a Ec2 instance
ec2:
key_name: yahoo
instance_type: t2.micro
region: "ap-south-1"
image: ami-0860c9429baba6ad2
count: 1
vpc_subnet_id: subnet-aa84fbe6
assign_public_ip: yes
tags:
- creation
- name: Going to Install Python
apt:
name: python
state: present
tags:
- Web
- name: Start the service
service:
name: python
state: started
tags:
- start
【问题讨论】:
标签: ansible