On Mon, 18 May 2020 at 17:29, Om Prasad Surapu <
prasa...@gmail.com> wrote:
>
> Hi Everyone,
>
> I have an ansible playbook which will be used to take AMI snapshot of EC2 instance every month in a year.
"Will be used" implies some existing mechanism to take snapshots.
The playbook you mentioned below doesn't seem to have any scheduling.
So what is the mechanism? Cloudwatch? Cron? Manual action?
> Now i got a new requirement that snapshot should not be taken for every month and it should for 3 months once. I checked ansible_date_time but did not see the logic to take every 3 months. It has just day, month and yearly like ansible_date_time.month.
Can you please explain a bit better what you mean by "it should for 3
months once"?
> here is my playbook (variable calls from template). Is there any way to take snapshot for every 3 months. It would be grateful if anyone could answer.
>
> ------------------------
>
> - hosts: localhost
> connection: local
>
> vars:
> - ami_instance_id: null
> - ami_date: "{{ ansible_date_time.month }}{{ ansible_date_time.year }}"
> - ami_name: null
> - ami_service: null
> tasks:
> - name: create AMI
> ec2_ami:
> instance_id: "{{ ami_instance_id }}"
> wait: yes
> name: "{{ ami_name }}_{{ ami_date }}"
> region: us-east-1
> tags:
> Name: "{{ ami_name }}_{{ ami_date }}"
> Service: "{{ ami_service }}"
> register: instance
>
> - debug: var=instance
Did you mean to post some results here?
--
Dick Visser
Trust & Identity Service Operations Manager
GÉANT