actions > ssh
action is a method that available in the
macfile used to fetch information.
It will get real time information from the instances.
ssh contains code in
bash that generates the output to retrieve.
This is better explained with an example. The following
macfile creates an instance in AWS
and then creates the AMI:
mac: 0.9.2 description: AMI creation from an instance name: demo version: '1.0' roles: app: instance create: # configuration configures the server with the application # bootstrap script available in github configuration: demo_application environment: - APP_BRANCH: master # branch activated in the application actions: # get_id action access via ssh to the instance # runs the ssh command and gets the response, # which is the instance id for AWS get_id: ssh: wget -q -O - http://169.254.169.254/latest/meta-data/instance-id resources: # creates AMI from the role 'app' create_image: create bash: aws ec2 create-image --instance-id infrastructure.image_base_inf.get_id --name DemoApplication --description MyDemoApplication --region infrastructure.image_base_inf.location infrastructures: # Infrastuctures creates roles and resources. Order is preserved. # create an E2C instance using the configuration for role 'app' image_base_inf: name: app provider: amazon location: us-east-1 hardware: t1.micro role: app # create the AMI from the E2C instance created before create_image_inf: ready: role.app resource: create_image