繁体   English   中英

带有ansible的重定向规则S3

[英]Redirection rules S3 with ansible

我对 ansible 和 awscli 很陌生。 我试图扮演一个角色来创建一个存储桶作为带有索引的网站。 一切正常,但我还想创建重定向规则。

使用 aws cli 命令,例如:

 - name: Create Bucket
   command: aws s3api create-bucket --bucket myskroto --acl public-read-write  --create-bucket-configuration LocationConstraint=eu-west-1
   become: yes

我能够创建所需的任务,但在 ansible 中我收到有关查找 bucket.js 文件的错误。 我应该把这个文件放在哪里?

 Unable to load paramfile file://bucket.js: [Errno 2] No such file or directory: 'bucket.js'"

Tring 而不是使用像这样的 asnible 模块:

- name: Configure an s3 bucket as a website with index and error pages
  s3_website:
    name: myskroto
    suffix: index.html
    error_key: errors/404.htm
    state: present

一切正常,但我无法填充重定向规则。 我可以使用哪个参数?

谢谢:)

解决了。 问题只是我调用的是 bucket.js 而不是 bucket.json。 一切都是固定的。 我将文件放在同一个 main.yml 根目录中。

test_ansible_roles/
├── bucket.json
├── ec2instances
│   ├── README.md
│   ├── defaults
│   │   └── main.yml
│   ├── handlers
│   │   └── main.yml
│   ├── meta
│   │   └── main.yml
│   ├── tasks
│   │   └── main.yml
│   ├── tests
│   │   ├── inventory
│   │   └── test.yml
│   └── vars
│       └── main.yml
├── main.yml
└── s3bucket
    ├── README.md
    ├── defaults
    │   └── main.yml
    ├── handlers
    │   └── main.yml
    ├── meta
    │   └── main.yml
    ├── tasks
    │   └── main.yml
    ├── tests
    │   ├── inventory
    │   └── test.yml
    └── vars
        └── main.yml

暂无
暂无

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

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