繁体   English   中英

使用Ansible Clouldformation模块配置CoreOS集群

[英]Using Ansible Clouldformation module to provision a CoreOS cluster

我是Ansible的新手,如果要从本地配置群集,我不确定主机文件的外观。 我的yaml文件如下:

---
- hosts: coreos
  tasks:
    - name: Automation CoreOS Cluster
      action: cloudformation >
        stack_name="automation_ansible_coreos_cluster" state=present
        region=us-east-1 disable_rollback=true
        template=files/coreos-stable-pv.template
      args:
        template_parameters:
          InstanceType: m1.small
          ClusterSize: 3
          DiscoveryURL: 'https://discovery.etcd.io/<val>'
          KeyPair: Automation
      tags:
        Stack: ansible-cloudformation-coreos

任何建议将被认真考虑。

将剧本转换为以下形式:

---
- hosts: localhost
  connection: local
  gather_facts: false
  tasks:
  - name: Automation CoreOS Cluster
    cloudformation: stack_name='automation_ansible_coreos_cluster' state=present region='us-east-1' disable_rollback=true template='files/coreos-stable-pv.template'
    args:
      template_parameters:
        InstanceType: m1.small
        ClusterSize: 3
        DiscoveryURL: 'https://discovery.etcd.io/<val>'
        KeyPair: Automation
    register: stack
    tags:
      Stack: ansible-cloudformation-coreos

将host设置为localhost并连接到local将解决您的问题,并增加了gather_facts: false将跳过从清单文件中收集信息,并继续配置您的机器,从而解决了寻找机器(尚未创建的机器)的需求!)

此外,您将需要具有足够访问权限的AWS用户凭证才能执行相关操作

以下工作

剧本:

---
- hosts: coreos
  connection: local
  tasks:
  - name: Automation CoreOS Cluster
    cloudformation: stack_name='automation-ansible-coreos-cluster' state=present region='us-east-1'         disable_rollback=true template='files/coreos-stable-pv.template'
    args:
      template_parameters:
        InstanceType: t1.micro
        ClusterSize: 3
        DiscoveryURL: 'https://discovery.etcd.io/<val>'
        KeyPair: Automation
    register: stack
    tags:
        Stack: ansible-cloudformation-coreos

主机文件:

[coreos]
host1
host2
host3

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM