小编Kat*_*ate的帖子

ansible sudo:对不起,您必须有一个tty才能运行sudo

当我设置具有云形成的环境时,我需要在Vagrant盒子和aws上运行剧本。

在Vagrant文​​件中,我使用ansible-local,一切正常

name: Setup Unified Catalog Webserver  
    hosts: 127.0.0.1  
    connection: local  
  become: yes  
  become_user: root
  roles: generic
Run Code Online (Sandbox Code Playgroud)

但是,当我在AWS中创建实例时,ansible剧本因错误而失败:
sudo: sorry, you must have a tty to run sudo
发生这种情况是因为它以root身份运行并且没有tty。但我不知道如何解决它没有作出改变/etc/sudoers,以允许!requiretty

我可以在ansible.cfg或云形成模板中设置任何标志吗?

  "#!/bin/bash\n", "\n", "   
 echo 'Installing Git'\n","  
  yum --nogpgcheck -y install git ansible htop nano wget\n",
 "wget https://s3.eu-central-1.amazonaws.com/XXX -O /root/.ssh/id_rsa\n", 
"chmod 600 /root/.ssh/id_rsa\n", 
"ssh-keyscan 172.31.7.235 >> /root/.ssh/known_hosts\n",
 "git clone git@172.31.7.235:something/repo.git /root/repo\n", 
"ansible-playbook /root/env/ansible/test.yml\n
Run Code Online (Sandbox Code Playgroud)

sudo aws-cloudformation ansible

8
推荐指数
2
解决办法
1万
查看次数

更改云形成模板中的 ElastiCache 节点 DNS 记录

我需要为 ElastiCache 集群创建 CNAME 记录。但是,我构建了redis集群,并且只有一个节点。据我发现 redis 集群没有 ConfigurationEndpoint.Address 。是否有机会更改集群中节点的 DNS 名称以及如何更改?

目前模板看起来像:

  "ElastiCahceDNSRecord" : {
  "Type" : "AWS::Route53::RecordSetGroup",
  "Properties" : {
    "HostedZoneName" : "example.com.",
    "Comment" : "Targered to ElastiCache",
    "RecordSets" : [{
    "Name" : "elche01.example.com.",
    "Type" : "CNAME",
    "TTL" : "300",
    "ResourceRecords" :  [
        {
            "Fn::GetAtt": [ "myelasticache", "ConfigurationEndpoint.Address" ]
        }
    ]

    }]

  }
Run Code Online (Sandbox Code Playgroud)

}

amazon-web-services amazon-elasticache aws-cloudformation amazon-route53

3
推荐指数
1
解决办法
2456
查看次数