Exemplo n.º 1
0
# Create an EC2 server that we'll then provision stuff onto.
size = 't2.micro'
if key_name is None:
    key = aws.ec2.KeyPair('key', public_key=public_key)
    key_name = key.key_name
server = aws.ec2.Instance(
    'server',
    instance_type=size,
    ami=ami.id,
    key_name=key_name,
    vpc_security_group_ids=[secgrp.id],
)
conn = provisioners.ConnectionArgs(
    host=server.public_ip,
    username='******',
    private_key=private_key,
    private_key_passphrase=private_key_passphrase,
)

# Copy a config file to our server.
cp_config = provisioners.CopyFile(
    'config',
    conn=conn,
    src='myapp.conf',
    dest='myapp.conf',
    opts=pulumi.ResourceOptions(depends_on=[server]),
)

# Execute a basic command on our server.
cat_config = provisioners.RemoteExec(
    'cat-config',
Exemplo n.º 2
0
            sku="18.04-LTS",
            version="latest",
        ),
    ),
)

# Get IP address as an output.
combined_output = Output.all(server.id, public_ip.name, resource_group.name)
public_ip_addr = combined_output.apply(
    lambda lst: network.get_public_ip_address(public_ip_address_name=lst[1],
                                              resource_group_name=lst[2]))

# Create connection object to server.
conn = provisioners.ConnectionArgs(
    host=public_ip_addr.ip_address,
    username=admin_username,
    private_key=private_key,
    private_key_passphrase=private_key_passphrase,
)

# Copy install script to server.
cp_config = provisioners.CopyFile(
    'config',
    conn=conn,
    src='install.sh',
    dest='install.sh',
    opts=pulumi.ResourceOptions(depends_on=[server]),
)

# Execute install script on server.
install = provisioners.RemoteExec(
    'install',
Exemplo n.º 3
0
    availability_zone=zone_names.apply(lambda names: names[0]),
    vpc_security_group_ids=[jumpbox_sg.id],
    subnet_id=subnet_infra.id,
    associate_public_ip_address=True,
    iam_instance_profile=jumpbox_iam_profile.id,
    source_dest_check=False,
    user_data=user_data,
    key_name=keypair.id,
    root_block_device={
        'volume_type': "standard",
        'volume_size': vol_size_ubuntu,
        'delete_on_termination': True
    },
    tags={
        'user:Project': pulumi.get_project(),
        'user:Stack': pulumi.get_stack(),
        'Name': 'jumpbox.pod.lab',
        'Owner': owner
    })

conn = provisioners.ConnectionArgs(host=jumpbox.public_ip,
                                   username='******',
                                   private_key=key.private_key_pem)

# ansible_runner.run_async(playbook="provisioning/provision_jumpbox.yml",
#                           ssh_key="aviKubernetes_pkey.pem",
#                           limit=jumpbox.public_ip,
#                           quiet=False)

pulumi.export('public_ip', jumpbox.public_ip)
pulumi.export('public_dns', jumpbox.public_dns)
Exemplo n.º 4
0
        private_endpoint_name=private_endpoint_resource.name)

    private_dns_vnet_link = network.VirtualNetworkLink(
        resource_name='zvnl-ncdb',
        resource_group_name=resource_group.name,
        location='global',
        virtual_network_link_name=net.name,
        virtual_network=network.SubResourceArgs(id=net.id),
        private_zone_name=private_dns_zone.name,
        registration_enabled=True,
        opts=ResourceOptions(
            depends_on=[private_dns_zone, private_dns_zone_group]))

conn = provisioners.ConnectionArgs(
    host="controller-{0}.{1}.cloudapp.azure.com".format(
        installation_id, location.lower()),
    username=controller_host_username,
    password=controller_host_password,
)

if db is None:
    resource_dependencies = [public_ip, vm]
else:
    resource_dependencies = [public_ip, db, vm]

copy_resources = ComponentResource(
    name='copy-controller-installer',
    t='remote:scp:CopyControllerInstallAssets',
    props={
        'cp_install_archive':
        provisioners.CopyFile(
            name='copy-controller-installer-archive'.format(installation_id),