summaryrefslogtreecommitdiff
path: root/doc/rtd
AgeCommit message (Collapse)Author
2019-02-22doc: update merging doc with fixes and some additional details/examplesRyan Harper
Update config merging documentation with cloud-config syntax fix. Add an example showing how to merge two files with runcmd.
2019-02-14EC2: Rewrite network config on AWS Classic instances every bootGuilherme G. Piccoli
AWS EC2 instances' network come in 2 basic flavors: Classic and VPC (Virtual Private Cloud). The former has an interesting behavior of having its MAC address changed whenever the instance is stopped/restarted. This behavior is not observed in VPC instances. In Ubuntu 18.04 (Bionic) the network "management" changed from ENI-style (etc/network/interfaces) to netplan, and when using netplan we observe the following block present in /etc/netplan/50-cloud-init.yaml: match: macaddress: aa:bb:cc:dd:ee:ff Jani Ollikainen noticed in Launchpad bug #1802073 that the EC2 Classic instances were booting without network access in Bionic after stop/restart procedure, due to their MAC address change behavior. It was narrowed down to the netplan MAC match block, that kept the old MAC address after stopping and restarting an instance, since the network configuration writing happens by default only once in EC2 instances, in the first boot. This patch changes the network configuration write to every boot in EC2 Classic instances, by checking against the "vpc-id" metadata information provided only in the VPC instances - if we don't have this metadata value, cloud-init will rewrite the network configuration file in every boot. This was tested in an EC2 Classic instance and proved to fix the issue; unit tests were also added for the new method is_classic_instance(). LP: #1802073 Reported-by: Jani Ollikainen <jani.ollikainen@ik.fi> Suggested-by: Ryan Harper <ryan.harper@canonical.com> Co-developed-by: Chad Smith <chad.smith@canonical.com> Signed-off-by: Guilherme G. Piccoli <gpiccoli@canonical.com>
2019-02-06correct grammar issue in instance metadata documentationDominic Schlegel
LP: #1802188
2019-01-08Add documentation on adding a datasource.Scott Moser
This adds documentation intended for a developer on how to add a new datasource to cloud-init.
2019-01-08doc: clean up some datasource documentation.Scott Moser
The change to datasources.rst here is obvious typo fix. The change to azure is to reduce the two 'Customization' sections to a single and clean up some other duplicate text.
2018-11-28doc: Change dns_nameserver property to dns_nameservers.Tomer Cohen
According to the examples in the page, v1 network config DNS should be defined using the dns_nameservers. The singular dns_nameserver is undefined.
2018-10-30query: better error when missing read permission on instance-dataChad Smith
Emit a permissions error instead of "Missing instance-data.json" when non-root user doesn't have read-permission on /run/cloud-init/instance-data.json
2018-10-25docs: remove colon from network v1 config example.Tomer Cohen
The docs for network v1 config contained a errant ':'. Simply drop it.
2018-10-17azure: Add apply_network_config option to disable network from IMDSChad Smith
Azure generates network configuration from the IMDS service and removes any preexisting hotplug network scripts which exist in Azure cloud images. Add a datasource configuration option which allows for writing a default network configuration which sets up dhcp on eth0 and leave the hotplug handling to the cloud-image scripts. To disable network-config from Azure IMDS, add the following to /etc/cloud/cloud.cfg.d/99-azure-no-imds-network.cfg: datasource:   Azure:     apply_network_config: False LP: #1798424
2018-10-09instance-data: Add standard keys platform and subplatform. Refactor ec2.Chad Smith
Add the following instance-data.json standardized keys: * v1._beta_keys: List any v1 keys in beta development, e.g. ['subplatform']. * v1.public_ssh_keys: List of any cloud-provided ssh keys for the instance. * v1.platform: String representing the cloud platform api supporting the datasource. For example: 'ec2' for aws, aliyun and brightbox cloud names. * v1.subplatform: String with more details about the source of the metadata consumed. For example, metadata uri, config drive device path or seed directory. To support the new platform and subplatform standardized instance-data, DataSource and its subclasses grew platform and subplatform attributes. The platform attribute defaults to the lowercase string datasource name at self.dsname. This method is overridden in NoCloud, Ec2 and ConfigDrive datasources. The subplatform attribute calls a _get_subplatform method which will return a string containing a simple slug for subplatform type such as metadata, seed-dir or config-drive followed by a detailed uri, device or directory path where the datasource consumed its configuration. As part of this work, DatasourceEC2 methods _get_data and _crawl_metadata have been refactored for a few reasons: - crawl_metadata is now a read-only operation, persisting no attributes on the datasource instance and returns a dictionary of consumed metadata. - crawl_metadata now closely represents the raw stucture of the ec2 metadata consumed, so that end-users can leverage public ec2 metadata documentation where possible. - crawl_metadata adds a '_metadata_api_version' key to the crawled ds.metadata to advertise what version of EC2's api was consumed by cloud-init. - _get_data now does all the processing of crawl_metadata and saves datasource instance attributes userdata_raw, metadata etc. Additional drive-bys: * unit test rework for test_altcloud and test_azure to simplify mocks and make use of existing util and test_helpers functions.
2018-09-25cli: add cloud-init query subcommand to query instance metadataChad Smith
Cloud-init caches any cloud metadata crawled during boot in the file /run/cloud-init/instance-data.json. Cloud-init also standardizes some of that metadata across all clouds. The command 'cloud-init query' surfaces a simple CLI to query or format any cached instance metadata so that scripts or end-users do not have to write tools to crawl metadata themselves. Since 'cloud-init query' is runnable by non-root users, redact any sensitive data from instance-data.json and provide a root-readable unredacted instance-data-sensitive.json. Datasources can now define a sensitive_metadata_keys tuple which will redact any matching keys which could contain passwords or credentials from instance-data.json. Also add the following standardized 'v1' instance-data.json keys:   - user_data: The base64encoded user-data provided at instance launch   - vendor_data: Any vendor_data provided to the instance at launch   - underscore_delimited versions of existing hyphenated keys:     instance_id, local_hostname, availability_zone, cloud_name
2018-09-11user-data: jinja template to render instance-data.json in cloud-configChad Smith
Allow users to provide '## template: jinja' as the first line or their #cloud-config or custom script user-data parts. When this header exists, the cloud-config or script will be rendered as a jinja template. All instance metadata keys and values present in /run/cloud-init/instance-data.json will be available as jinja variables for the template. This means any cloud-config module or script can reference any standardized instance data in templates and scripts. Additionally, any standardized instance-data.json keys scoped below a '<v#>' key will be promoted as a top-level key for ease of reference in templates. This means that '{{ local_hostname }}' is the same as using the latest '{{ v#.local_hostname }}'. Since instance-data is written to /run/cloud-init/instance-data.json, make sure it is persisted across reboots when the cached datasource opject is reloaded. LP: #1791781
2018-08-17Add datasource Oracle Compute Infrastructure (OCI).Scott Moser
This adds a Oracle specific datasource that functions with OCI. It is a simplified version of the OpenStack metadata server with support for vendor-data. It does not support the OCI-C (classic) platform. Also here is a move of BrokenMetadata to common 'sources' as this was the third occurrence of that class.
2018-08-07docs: Fix example cloud-init analyze command to match output.Wesley Gao
Fix a typo in in documentation that showed 'analyze blame' but intended to show 'analyze dump'.
2018-07-03Fix boothook docs on environment variable name (INSTANCE_I -> INSTANCE_ID)Marc Tamsky
2018-06-15openstack: avoid unneeded metadata probe on non-openstack platformsChad Smith
OpenStack datasource is now discovered in init-local stage. In order to probe whether OpenStack metadata is present, it performs a costly sandboxed dhclient setup and metadata probe against http://169.254.169.254 for openstack data. Cloud-init properly detects non-OpenStack on EC2, but it spends precious time probing the metadata service also resulting in a confusing WARNING log about 'metadata not present'. To avoid the wasted cycles, and confusing warning, get_data will call a detect_openstack function to quickly determine whether the platform looks like OpenStack before trying to setup network to probe and crawl the metadata service. LP: #1776701
2018-06-12test: add optional --preserve-instance arg to integraiton testsChad Smith
By default, integration tests destroy the test instances after each test run. To aid debug and development of integration tests, support a --preserve-instance argument which will leave the modified test instance in a stopped state for further debug.
2018-06-12netplan: fix mtu if provided by network config for all rendered typesChad Smith
When network configuration for any interface defines maximum transmission values (MTU) the netplan, eni and sysconfig renders will take into account any device-level, or subnet-level mtu values. When network configuration has conflicting device-level and ipv4 subnet mtu values, the subnet-specific value is honored and a warning will be logged about any ignored device-level setting. LP: #1774666
2018-05-24doc: Add config info to ec2, openstack and cloudstack datasource docsChad Smith
Also document instance-data.json on the top-level datasource topic page.
2018-04-19doc: Add documentation for AliYun datasource.Junjie Wang
Just add some documentation to readthedocs for AliYun.
2018-03-29doc: Fix links in OpenStack datasource documentation.Dominic Schlegel
Fix link to external openstack resource and to internal vendor data. LP: #1721660
2018-03-22ubuntu-advantage: Add new config module to support ubuntu-advantage-toolsChad Smith
ubuntu-advantage-tools is a package for enabling and disabling extended support services such as Extended Security Maintenance (ESM), Canonical Livepatch and FIPS certified PPAs. Simplify Ubuntu Advantage setup on machines by allowing users to provide a list of ubuntu-advantage commands in cloud-config.
2018-03-16cc_snap: Add new module to install and configure snapd and snap packages.Chad Smith
Support installing and configuring snaps on ubuntu systems. Now, cloud-config files can provide a list or dictionary of snap:assertions which will be allow configuration of snapd on a system via 'snap ack' calls. The snap:commands configuration option supports arbitrary system commands intended to interact with snappy's cli. This allows users to run arbitrary snappy commands to create users, download, install and configure snap packages and snapd. This branch also deprecates old snappy and snap_config modules leaving warnings in documentation and runtime for consumers of these modules. Deprecated snap* modules will be dropped in cloud-init v.18.2 release.
2018-03-15doc: fix all warnings issued by 'tox -e doc'Scott Moser
Building doc would issue some warnings. This fixes all the warnings, and changes the "code blocks" that were listed as 'bash' to instead be 'shell-session'.
2018-01-29docs: Update RTD content for cloud-init subcommands.Chad Smith
Give a bit more detailed information which others can quickly reference to discover new CLI subcommand functionality. This section was a bit stale as we've introduced cloud-init status, clean and analyze content that was a bit under represented. Since we've had a few request of externals who try to run cloud-init subcommands on the commandline instead of rebooting, it's probably worth a bit of content here to describe how those init and module subcommands work.
2018-01-24docs: Fix typos in docs and one debug message.aRkadeFR
Fix obvious typos. Replace 'for for' with a 'for'.
2018-01-05tests: Enable AWS EC2 Integration TestingJoshua Powers
This enables integration tests to utilize AWS EC2 as a testing platform by utilizing the boto3 Python library. Usage will create and delete a custom VPC for every run. All resources will be tagged with the ec2 tag, 'cii', and the date (e.g. cii-20171220-102452). The VPC is setup with both IPv4 and IPv6 capabilities, but will only hand out IPv4 addresses by default. Instances will have complete Internet access and have full ingress and egress access (i.e. no firewall). SSH keys are generated with each run of the integration tests with the key getting uploaded to AWS at the start of tests and deleted on exit. To enable creation when the platform is setup the SSH generation code is moved to be completed by the platform setup and not during image setup. The nocloud-kvm platform was updated with this change. Creating a custom image will utilize the same clean script, boot_clean_script, that the LXD platform uses as well. The custom AMI is generated, used, and de-registered after a test run. The default instance type is set to t2.micro. This is one of the smallest instance types and is free tier eligible. The default timeout for ec2 was increased to 300 from 120 as many tests hit up against the 2 minute timeout and depending on region load can go over. Documentation for the AWS platform was added with the expected configuration files for the platform to be used. There are some additional whitespace changes included as well. pylint exception was added for paramiko and simplestreams. In the past these were not already flagged due to no __init__.py in the subdirectories of files that used these. boto3 was added to the list of dependencies in the tox ci-test runner. In order to grab console logs on EC2 the harness will now shut down an instance before terminating and before collecting the console log. This is to address a behavior of EC2 where the console log is refreshed very infrequently, but one point when it is refreshed is after shutdown.
2017-09-21doc: document GCE datasource.Arnd Hannemann
Add some minimal documentation for GCE datasource.
2017-08-31upstart: do not package upstart jobs, drop ubuntu-init-switch module.Scott Moser
The ubuntu-init-switch module allowed the use to launch an instance that was booted with upstart and have it switch its init system to systemd and then reboot itself. It was only useful for the time period when Ubuntu was transitioning to systemd but only produced images using upstart. Also, do not run setup with --init-system=upstart. This means that by default, debian packages built with packages/bddeb will not have upstart unit files included. No other removal is done here.
2017-08-25doc: Explain error behavior in user data include file format.Jason Butz
Update user data 'include file' format documentation to explain the behavior that occurs when an error occurs while reading a file.
2017-08-22schema cli: Add schema subcommand to cloud-init cli and cc_runcmd schemaChad Smith
This branch does a few things: - Add 'schema' subcommand to cloud-init CLI for validating cloud-config files against strict module jsonschema definitions - Add --annotate parameter to 'cloud-init schema' to annotate existing cloud-config file content with validation errors - Add jsonschema definition to cc_runcmd - Add unit test coverage for cc_runcmd - Update CLI capabilities documentation This branch only imports development (and analyze) subparsers when the specific subcommand is provided on the CLI to avoid adding costly unused file imports during cloud-init system boot. The schema command allows a person to quickly validate a cloud-config text file against cloud-init's known module schemas to avoid costly roundtrips deploying instances in their cloud of choice. As of this branch, only cc_ntp and cc_runcmd cloud-config modules define schemas. Schema validation will ignore all undefined config keys until all modules define a strict schema. To perform validation of runcmd and ntp sections of a cloud-config file: $ cat > cloud.cfg <<EOF runcmd: bogus EOF $ python -m cloudinit.cmd.main schema --config-file cloud.cfg $ python -m cloudinit.cmd.main schema --config-file cloud.cfg \ --annotate Once jsonschema is defined for all ~55 cc modules, we will move this schema subcommand up as a proper subcommand of the cloud-init CLI.
2017-08-21tools: Add tooling for basic cloud-init performance analysis.Chad Smith
This branch adds cloudinit-analyze into cloud-init proper. It adds an "analyze" subcommand to the cloud-init command line utility for quick performance assessment of cloud-init stages and events. On a cloud-init configured instance, running "cloud-init analyze blame" will now report which cloud-init events cost the most wall time. This allows for quick assessment of the most costly stages of cloud-init. This functionality is pulled from Ryan Harper's analyze work. The cloudinit-analyze main script itself has been refactored a bit for inclusion as a subcommand of cloud-init CLI. There will be a followup branch at some point which will optionally instrument detailed strace profiling, but that approach needs a bit more discussion first. This branch also adds: * additional debugging topic to the sphinx-generated docs describing cloud-init analyze, dump and show as well as cloud-init single usage. * Updates the Makefile unittests target to include cloudinit directory because we now have unittests within that package. LP: #1709761
2017-08-15doc: update capabilities with features available, link doc reference, cli ↵Ryan Harper
example
2017-07-11doc: document the cmdline options to NoCloudBrian Candler
Add permitted keys to documentation on seeding NoCloud.
2017-06-15docs: Automatically generate module docs form schema if present.Chad Smith
We have started adding jsonschema definitions for cloudconfig modules (cc_ntp). This branch allows us render sphinx docs using the module's shema definition instead of using the module's docstring. This allows us to avoid duplicating schema documentation in the module-level docstring and schema definition. The corresponding module documentation is extended a bit to differentiate between config schema and potential examples.
2017-06-08Integration Testing: tox env, pyxld 2.2.3, and revamp frameworkWesley Wiedenmeier
Massive update to clean up and greatly enhance the integration testing framework developed by Wesley Wiedenmeier. - Updated tox environment to run integration test 'citest' to utilize pylxd 2.2.3 - Add support for distro feature flags - add framework for feature flags to release config with feature groups and overrides allowed in any release conf override level - add support for feature flags in platform and config handling - during collect, skip testcases that require features not supported by the image with a warning message - Enable additional distros (i.e. centos, debian) - Add 'bddeb' command to build a deb from the current working tree cleanly in a container, so deps do not have to be installed on host - Adds a command line option '--preserve-data' that ensures that collected data will be left after tests run. This also allows the directory to store collected data in during the run command to be specified using '--data-dir'. - Updated Read the Docs testing page and doc strings for pep 257 compliance
2017-06-06NoCloud: support seed of nocloud from smbios informationVladimir Pouzanov
This allows the user to seed NoCloud in a trivial way from qemu/libvirt, by using a stock image and passing a single command line flag. No custom command line, no filesystem modification, no bootstrap disk image. This is particularly handy now that Ec2 backend is discouraged from use under bug 1660385. LP: #1691772
2017-06-06fix typos and remove whitespace in various docsStephan Telling
2017-05-03doc: document network configuration defaults policy and formats.Ryan Harper
Add documentation for cloud-init networking configuration formats, default behavior, policy and other specific details about how network config is consumed and utilized.
2017-04-21Doc: add additional RTD examplesJoshua Powers
Includes missing examples for RTD, including examples for datasources, disk partitions and apt update. Also fix doc in cloud-config-update-apt.txt. LP: #1459604
2017-04-12Fix examples that reference upstream chef repository.Jon Grimm
Also add integration test. Note: this new test is not comprehensive; it simply ensures that the example chef configuration does not blow up and that chef seems to be installed after its completion. This new test is disabled by default as it depends on a 3rd party repository. LP: #1678145
2017-04-12doc: correct grammar and improve clarity in merging documentation.David Tagatac
Move merging.rst into doc/rtd/topics with small fixes.
2017-04-12doc: Add missing doc link to snap-config module.Ryan Harper
2017-03-30doc: correct grammar in capabilities.rstDavid Tagatac
2017-03-17doc: fix config drive doc with regard to unpartitioned disks.Scott Moser
The ConfigDrive datasource has read un-partitioned disks for quite a while, but the documentation lagged behind. LP: #1673818
2017-03-13doc: add instructions for running integration tests via tox.Joshua Powers
Add instructions on how to run the cii tests to the docs.
2017-03-10Add feature flags to cloudinit.version.Wesley Wiedenmeier
This exposes a mechanism for users of cloud-init to determine if a version has a specific feature, and adds documentation to that affect. We list an existing feature NETWORK_CONFIG_V1 as an example. Also add a 'features' subcommand for listing these to stdout.
2017-01-26Fix small typo and change iso-filename for consistencyRobin Naundorf
* Fix small typo * Fix ISO-Filename for consistency
2017-01-17doc: Fix typos and clarify some aspects of the part-handlerErik M. Bray
The existing documentation referred to a handle_type method when it really should be handle_part. It also referred to 'methods' when it really should say 'functions' to be clear (while it's true the built-in handlers are classes with methods of these names, in this context we mean module-level functions). Also clarified that a part-handler should come before the parts that it handles, and can override built-in handlers.
2017-01-17doc: add some documentation on OpenStack datasource.Scott Moser
This just fills out some of the documentation on the OpenStack datasource.